diff --git a/auto-update b/auto-update index 84849c7..d7e0a5b 100755 --- a/auto-update +++ b/auto-update @@ -27,19 +27,22 @@ latest() { : \ && { [ -d "$dir" ] && [ -f "$dir/$df" ] && [ -s "$dir/$df" ] \ || { note "missing $df, skipping $dir ($tag)"; continue ;} \ ;} \ - && ours="$(grep -F "$tag"= "$dir/$df" | grep -Eo '[0-9a-f]{40}')" \ + && grep -Fq "$tag=" "$dir/$df" \ + && ours="$(grep -F "$tag=" "$dir/$df" | cut -d= -f2-)" \ && theirs="$(latest "$url")" ours="${ours%%$n*}" theirs="${theirs%%$n*}" \ - && if [ ${#ours} = 0 ] || [ ${#theirs} = 0 ] \ + && if [ ${#theirs} = 0 ] \ ;then note "failed to retrieve update for $dir ($tag)" \ ;elif [ "$ours" != "$theirs" ] \ ;then any=1 && note "updating $dir ($tag)" \ && other="${tag%_COMMIT}_SHA256" && tgz="${url%/}" \ && tgz="${tgz%%/tree/*}" && tgz="$tgz/archive/$theirs.tar.gz" \ && { sum="$(curl $flags "$tgz" | sha256sum - | awk '{print $1}')" \ - && notwa-util/shed "$dir/$df" "s/$ours/$theirs/g" \ + && notwa-util/shed "$dir/$df" "s/$tag=$ours/$tag=$theirs/g" \ && notwa-util/shed "$dir/$df" "s/$other=.*/$other=$sum/g" \ ;} \ || note "failed to apply update for $dir ($tag)" \ - ;fi ;done \ + ;fi \ + || note "failed to determine update for $dir ($tag)" \ + ;done \ && { [ $any = 1 ] || note "no new updates" ;} \ ;