Improve update.sh to handle single-line https://julialang.org/downloads/ content

This commit is contained in:
Tianon Gravi 2020-03-16 18:22:42 -07:00
parent 060ea873f7
commit f10e112fa7
1 changed files with 3 additions and 2 deletions

View File

@ -18,9 +18,10 @@ sed_escape_rhs() {
rcRegex='-(pre[.])?(alpha|beta|rc)[0-9]*'
pattern='.*/julia-([0-9]+\.[0-9]+\.[0-9]+('"$rcRegex"')?)-linux-x86_64\.tar\.gz.*'
pattern='[^"]*/julia-([0-9]+\.[0-9]+\.[0-9]+('"$rcRegex"')?)-linux-x86_64\.tar\.gz[^"]*'
allVersions="$(
curl -fsSL 'https://julialang.org/downloads/' \
| grep -oE "$pattern" \
| sed -rn "s!${pattern}!\1!gp" \
| sort -ruV
)"
@ -35,7 +36,7 @@ for version in "${versions[@]}"; do
fi
rcGrepV+=' -E'
fullVersion="$(echo "$allVersions" | grep -E "^${rcVersion}([.-]|$)" | grep $rcGrepV -- "$rcRegex" | head -1)"
fullVersion="$(grep -E "^${rcVersion}([.-]|$)" <<<"$allVersions" | grep $rcGrepV -- "$rcRegex" | head -1)"
if [ -z "$fullVersion" ]; then
echo >&2 "error: failed to determine latest release for '$version'"
exit 1