Compare commits
3 Commits
v1.5.0_FIN
...
main
Author | SHA1 | Date |
---|---|---|
yosh | 1253d60e45 | |
yosh | 9fbbc2fbb6 | |
yosh | 66ffa456eb |
20
flacconv
20
flacconv
|
@ -8,8 +8,6 @@ set -euf
|
|||
BN="${0##*/}"
|
||||
NL='
|
||||
'
|
||||
export POSIXLY_CORRECT=1
|
||||
|
||||
if [ -n "${NO_COLOR:-}" ]; then
|
||||
RED="" GREEN="" YELLOW="" RESET=""
|
||||
fi
|
||||
|
@ -40,17 +38,27 @@ trap "cleanup" INT HUP QUIT TERM EXIT
|
|||
|
||||
checkupdate() {
|
||||
errecho "checking for updates from https://git.unix.dog/yosh/flacconv/src/branch/main/flacconv..."
|
||||
errecho
|
||||
tmpupdate=$(mktemp)
|
||||
curl -s -o "$tmpupdate" 'https://git.unix.dog/yosh/flacconv/raw/branch/main/flacconv' || fail "curl request failed! retry probably"
|
||||
if cmp "$tmpupdate" "$0"; then
|
||||
if cmp -s "$tmpupdate" "$0"; then
|
||||
errecho "you are updated!"
|
||||
else
|
||||
printf '%s' "the latest commit differs from the current version. if you use git, please git pull the repo for the update"
|
||||
printf '%s' "you can see the changes here: https://git.unix.dog/yosh/flacconv/commits/branch/main"
|
||||
errecho "the latest commit differs from the current version. if you use git, please git pull the repo for the update"
|
||||
errecho "you can see the changes here: https://git.unix.dog/yosh/flacconv/commits/branch/main"
|
||||
printf '%s' "if you don't use git, apply update directly? [y/n] " >&2
|
||||
read -r choice
|
||||
case "$choice" in
|
||||
[Yy]) chmod +x "$tmpupdate" && mv -f "$tmpupdate" "$0" && errecho "updated!" || fail "applying update failed! retry probably" ;;
|
||||
[Yy])
|
||||
if [ -L "$0" ]; then
|
||||
errecho "${RED}your flacconv patch is a symbolic link."
|
||||
errecho "while it is possible to resolve them in a POSIX manner, it's a weird amount of code"
|
||||
errecho "so I humbly ask that you update it manually"
|
||||
exit 1
|
||||
fi
|
||||
mv -f "$tmpupdate" "$0"
|
||||
errecho "updated!"
|
||||
;;
|
||||
*) errecho "not applying update!" ;;
|
||||
esac
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue