LucasLarson / update

update all the things
Other
1 stars 0 forks source link

update version check fails: ./update: line 21: test: : integer expression expected #33

Open klodeckl opened 1 year ago

klodeckl commented 1 year ago

The version check for the script fails when running the script: ./update: line 21: test: : integer expression expected

Am I doing something wrong? I downloaded just the script, made a chmod +x update und executed it without parameters.

LucasLarson commented 1 year ago

Thank you for the feedback and sorry about the trouble.

klodeckl commented 1 year ago

Yes, I can access the page in a browser.

The commands get the following output:

command -v wget; printf '%d\n' "$?"; command -v curl; printf '%d\n' "$?" /usr/local/bin/wget 0 /usr/bin/curl 0

( set -- 'https://lucaslarson.net/update' 'https://github.com/LucasLarson/update/raw/main/update'; { wget -qO- -- "${1-}" || curl -Ls -- "${1-}"; } | cksum; { wget -qO- -- "${2-}" || curl -Ls -- "${2-}"; } | command cksum; ) 3005792971 8932 3005792971 8932

( PS4=''; set -Ceuxo noglob; set -- 'https://lucaslarson.net/update'; update='2023-07-16'; command test "$({ wget -qO- -- "${1-}" || curl -Ls -- "${1-}"; } | command sed -n -e '/update=/ {' -e 's/[^[:digit:]]//gp' -e 'q' -e '}')" -le "$(command printf -- '%s\n' "${update-}" | command sed -e 's/[^[:digit:]]//g')"; ) set -- https://lucaslarson.net/update update=2023-07-16 wget -qO- -- https://lucaslarson.net/update command sed -n -e '/update=/ {' -e 's/[^[:digit:]]//gp' -e q -e '}' sed -n -e '/update=/ {' -e 's/[^[:digit:]]//gp' -e q -e '}' command printf -- '%s\n' 2023-07-16 printf -- '%s\n' 2023-07-16 command sed -e 's/[^[:digit:]]//g' sed -e 's/[^[:digit:]]//g' command test 20230716 -le 20230716 test 20230716 -le 20230716

LucasLarson commented 1 year ago

Does it work when you run it like this:

mkdir -p /tmp/sandbox && cd /tmp/sandbox && git clone https://github.com/LucasLarson/update /tmp/sandbox
./update

If so, then I’m guessing there’s something happening (perhaps with encoding?) when you:^1

downloaded just the script

klodeckl commented 8 months ago

Sorry for my late. I tested it, same issue. Same if I execute the failing command:

ecklbd:~ ec$ set -- 'https://lucaslarson.net/update'
ecklbd:~ ec$ command -p -- test "$({ command wget --hsts-file=/dev/null --output-document=- --quiet -- "${1-}" || command curl --location --silent -- "${1-}"; } 2>/dev/null | command -p -- sed -n -e '/update=/ {' -e 's/[^[:digit:]]//gp' -e 'q' -e '}')" -le "$(command -p -- printf -- '%s\n' "${update-}" | command -p -- sed -e 's/[^[:digit:]]//g')" || {
>   command -p -- printf -- 'An update to this updater is available\041 Download it here:\n%s\n' "${1-}" >&2
>   unset -v -- update 2>/dev/null || update=''
>   exit
> set -- 'https://lucaslarson.net/update'
ecklbd:~ ec$ set -- 'https://lucaslarson.net/update'
ecklbd:~ ec$ command -p -- test "$({ command wget --hsts-file=/dev/null --output-document=- --quiet -- "${1-}" || command curl --location --silent -- "${1-}"; } 2>/dev/null | command -p -- sed -n -e '/update=/ {' -e 's/[^[:digit:]]//gp' -e 'q' -e '}')" -le "$(command -p -- printf -- '%s\n' "${update-}" | command -p -- sed -e 's/[^[:digit:]]//g')" || {
>   command -p -- printf -- 'An update to this updater is available\041 Download it here:\n%s\n' "${1-}" >&2
>   unset -v -- update 2>/dev/null || update=''
>   #exit
> }
-bash: test: : integer expression expected
An update to this updater is available! Download it here:
https://lucaslarson.net/update
ecklbd:~ ec$
LucasLarson commented 7 months ago

Sorry for my late

Not at all. I appreciate the feedback.

I tested it, same issue.

Can you please try this alternative fix before I merge a change (957ec5ac74) which might not be unnecessary?

Does it work when you run it like this:

mkdir -p /tmp/sandbox && cd /tmp/sandbox && git clone https://github.com/LucasLarson/update /tmp/sandbox && /tmp/sandbox/update