Enable the (existing) custom error message for the invalid checksum case

We add a `set +e` around the `sha256sum` invocation, otherwise the shell
errors out instantly (because of the `set -e` at the top), so we have
the chance to print out the custom error message. We `set -e` as soon as
we grab the return value from `sha256sum`.
This commit is contained in:
sasha 2023-02-16 16:55:59 -08:00
parent 086d3edfc3
commit 862c52c48b
1 changed files with 2 additions and 0 deletions

View File

@ -141,12 +141,14 @@ fetch_params() {
cat "${dlname}.part.1" "${dlname}.part.2" > "${dlname}" cat "${dlname}.part.1" "${dlname}.part.2" > "${dlname}"
rm "${dlname}.part.1" "${dlname}.part.2" rm "${dlname}.part.1" "${dlname}.part.2"
set +e
"$SHA256CMD" $SHA256ARGS -c <<EOF "$SHA256CMD" $SHA256ARGS -c <<EOF
$expectedhash $dlname $expectedhash $dlname
EOF EOF
# Check the exit code of the shasum command: # Check the exit code of the shasum command:
CHECKSUM_RESULT=$? CHECKSUM_RESULT=$?
set -e
if [ $CHECKSUM_RESULT -eq 0 ]; then if [ $CHECKSUM_RESULT -eq 0 ]; then
mv -v "$dlname" "$output" mv -v "$dlname" "$output"
else else