1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-25 20:58:37 -06:00

Various improvements

This commit is contained in:
Sayantan Santra 2022-12-03 03:09:23 -06:00
parent 68813174ce
commit 9372256310
3 changed files with 7 additions and 4 deletions

0
ethernet-on-boot.sh Executable file → Normal file
View file

0
ibus-on-boot.sh Executable file → Normal file
View file

View file

@ -4,17 +4,20 @@
# The regular upgrade function of lure doesn't suffice since # The regular upgrade function of lure doesn't suffice since
# I use automatically updating version names in my install scripts # I use automatically updating version names in my install scripts
[ -f "$1" ] || echo "Please pass location of a list with github repo names" ! command -v lure>/dev/null && echo "lure is not installed" && exit
! [ -f "$1" ] && echo "Please pass location of a list with github repo names" && exit
lure_list=$(lure list --installed 2>/dev/null | grep -v 'INF')
for f in $(cat "$1" | tr '\n' ' ') for f in $(cat "$1" | tr '\n' ' ')
do do
pkg="$(echo $f | cut -d '/' -f 2)" pkg="$(echo $f | cut -d '/' -f 2)"
version_new=$(lure info $pkg | grep version | awk '{printf $2}' | sed 's/[a-zA-Z]*//g') version_new=$(lure info $pkg 2>/dev/null | grep version | awk '{printf $2}' | sed 's/[a-zA-Z]*//g')
[ "$version_new" == "" ] && version_new="$(curl -sL "https://api.github.com/repos/${f}/releases/latest" | jq -r '.tag_name' | sed 's/[a-zA-Z]*//g')" [ "$version_new" == "" ] && version_new="$(curl -sL "https://api.github.com/repos/${f}/releases/latest" | jq -r '.tag_name' | sed 's/[a-zA-Z]*//g')"
version_present="$(dnf info $pkg 2>/dev/null | grep Version | awk '{printf $3}' | sed 's/[a-zA-Z]*//g')" version_present=$(echo "$lure_list" | grep $pkg | cut -d' ' -f2 | cut -d- -f1 | sed 's/[a-zA-Z]*//g')
[ "$version_present" == "" ] && echo "$pkg isn't installed, skipping" && continue [ "$version_present" == "" ] && echo "$pkg isn't installed, skipping" && continue
if [ $(echo $version_present$'\n'$version_new | sort -V | tail -n1) != $version_present ]; then if [ $(echo $version_present$'\n'$version_new | sort -V | tail -n1) != $version_present ]; then
echo "Upgrading $pkg" echo "Upgrading $pkg ($version_present -> $version_new)"
lure install $pkg lure install $pkg
else else
echo "$pkg is up-to-date" echo "$pkg is up-to-date"