diff options
Diffstat (limited to 'repos')
| -rwxr-xr-x | repos/outdated.sh | 46 | ||||
| -rwxr-xr-x | repos/update.sh | 12 |
2 files changed, 43 insertions, 15 deletions
diff --git a/repos/outdated.sh b/repos/outdated.sh index 5af614c8..af78350c 100755 --- a/repos/outdated.sh +++ b/repos/outdated.sh @@ -1,29 +1,45 @@ #!/bin/sh +fetchversion() { + curl -SsZA tmp https://repology.org/badge/latest-versions/$1.svg \ + | sed 's/, /,/g' \ + | tr ' ' '\n' \ + | grep -Eo 'central">.*<' \ + | sed 's/<.*//;s/.*>//' \ + | tr ',' '\n' \ + | tail -n1 +} + while [ "$1" ]; do unset curver port [ -f $1/abuild ] && port=${1%/} [ "$port" ] || { shift; continue; } - pname=${1##*/} + name=${1#*/}; name=${name%/} curver=$(grep ^version= $port/abuild | awk -F = '{print $2}') [ "$curver" ] || { shift; continue; } - case $pname in - python-*) pname=python:${pname#python-};; - perl-*) pname=perl:${pname#perl-};; + case $name in + python-*) name=python:${name#python-};; + perl-*) name=perl:${name#perl-};; esac - #clang) pname=llvm;; - #dejavu-fonts-ttf) pame=fonts:dejavu;; - #lcms2) pname=lcms;; - #libconfig) pname=libconfig-hyperrealm;; - #xf86-input-libinput) pname=xdrv:libinput;; - #esac + # clear newver function + unset -f newver if [ -s $port/outdated ]; then - pname=$(cat $port/outdated | tail -n1) + . $port/outdated + fi + printf " checking $1\033[0K\r" + newver=$(fetchversion $name) + if [ "$(command -v newver)" ]; then + newver fi - v=$(curl -SsZA tmp https://repology.org/badge/latest-versions/$pname.svg | grep middle | sed 's/.*middle">//;s/<.*//;s/,//' | tr ' ' '\n' | tail -n1) - [ "$v" ] || v=404 - if [ "$curver" != "$v" ]; then - echo "$port $v ($curver)" + touch outdate.error outdate.list + sed "\|^$port .*|d" -i outdate.error + sed "\|^$port .*|d" -i outdate.list + if [ ! "$newver" ] || [ "$newver" = '-' ]; then + echo "$port $curver" >> outdate.error + elif [ "$curver" != "$newver" ]; then + echo "$port $newver ($curver)" + echo "$port $newver ($curver)" >> outdate.list fi shift done +printf "\033[0K" diff --git a/repos/update.sh b/repos/update.sh new file mode 100755 index 00000000..49c93acf --- /dev/null +++ b/repos/update.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +for i in $(awk '{print $1}' outdate.list); do + [ -d $i ] || continue + nv=$(grep ^"$i " outdate.list | awk '{print $2}') + ov=$(grep ^"$i " outdate.list | awk '{print $3}') + read -p "Update $i $ov to $nv " aaa + case $aaa in + n|N|no|NO|No|nO) continue;; + *) ./pkgup.sh $i $nv;; + esac +done |