diff options
| author | emmett1 <emmett1.2miligrams@protonmail.com> | 2025-01-29 01:09:38 +0800 |
|---|---|---|
| committer | emmett1 <emmett1.2miligrams@protonmail.com> | 2025-01-29 01:09:38 +0800 |
| commit | f69f99008217bb17338ee8a108391bef3d3b95d0 (patch) | |
| tree | cc7edcefd0e9e2a0a45c30ea8066bc77afd80560 /repos/outdated.sh | |
| parent | 280e0a4c3824e219cbed9bfa93a9f5c832b76d4a (diff) | |
| download | alicelinux-f69f99008217bb17338ee8a108391bef3d3b95d0.tar.gz alicelinux-f69f99008217bb17338ee8a108391bef3d3b95d0.zip | |
update scripts
Diffstat (limited to 'repos/outdated.sh')
| -rwxr-xr-x | repos/outdated.sh | 46 |
1 files changed, 31 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" |