mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-26 13:18:35 -06:00
Add lure-update.sh
This commit is contained in:
parent
14a7662be4
commit
3f6de1be60
2 changed files with 19 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
![Number of scripts](https://img.shields.io/badge/number_of_scripts-30-blue)
|
![Number of scripts](https://img.shields.io/badge/number_of_scripts-31-blue)
|
||||||
# Random Scripts
|
# Random Scripts
|
||||||
This repository is for random scripts I wrote mostly for personal use.
|
This repository is for random scripts I wrote mostly for personal use.
|
||||||
|
|
||||||
|
|
18
lure-update.sh
Normal file
18
lure-update.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ -f "$1" ] || echo "Please pass location of a list with github repo names"
|
||||||
|
|
||||||
|
for f in $(cat "$1" | tr '\n' ' ')
|
||||||
|
do
|
||||||
|
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" == "" ] && 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 "$pkg isn't installed, skipping" && continue
|
||||||
|
if [ $(echo $version_present$'\n'$version_new | sort -V | tail -n1) != $version_present ]; then
|
||||||
|
echo "Upgrading $pkg"
|
||||||
|
lure install $pkg
|
||||||
|
else
|
||||||
|
echo "$pkg is up-to-date"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in a new issue