This commit is contained in:
Conny Brunnkvist 2025-12-20 19:38:39 +08:00 committed by GitHub
commit fddaeae549
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

12
sbt
View File

@ -139,16 +139,23 @@ jar_url () {
download_url () {
local url="$1"
local jar="$2"
local exit_code
mkdir -p $(dirname "$jar") && {
if command -v curl > /dev/null; then
curl --silent -L "$url" --output "$jar"
curl --fail --silent -L "$url" --output "$jar"
exit_code=$?
elif command -v wget > /dev/null; then
wget --quiet -O "$jar" "$url"
exit_code=$?
else
echoerr "failed to download $url: Neither curl nor wget is available"
exit 2
fi
} && [[ -f "$jar" ]]
$(exit "$exit_code") && [[ -f "$jar" ]]
} || {
echoerr "Error while fetching ${url}"
rm -f "$jar"
}
}
acquire_sbt_jar () {
@ -177,6 +184,7 @@ acquire_sbt_jar () {
exit 2
fi
else
echoerr "$(command shasum 2>&1 | grep -o 'shasum:.*') - JAR checksum verification SKIPPED!"
mv "${download_jar}.temp" "${download_jar}"
fi
if [[ -f "$download_jar" ]]; then