Use exit codes, don't wrap download() with execute()

This commit is contained in:
2024-11-04 11:09:06 -05:00
parent a130da3e26
commit b41b75ff64

View File

@@ -664,7 +664,7 @@ acquire_deb() {
# Loop through the repositories and attempt to download # Loop through the repositories and attempt to download
for repo in "${repos[@]}"; do for repo in "${repos[@]}"; do
echo "Checking $repo for DEB package" echo "Checking $repo for DEB package"
if execute download "$repo" "$MC_DEB"; then if download "$repo" "$MC_DEB"; then
echo "Found" echo "Found"
break break
fi fi
@@ -1713,12 +1713,12 @@ download() {
fi fi
if [[ ${download_cmd[0]} == "wget" ]]; then if [[ ${download_cmd[0]} == "wget" ]]; then
"${download_cmd[@]}" --output-document="${output:--}" "$url" || return 1 "${download_cmd[@]}" --output-document="${output:--}" "$url"
elif [[ ${download_cmd[0]} == "curl" ]]; then elif [[ ${download_cmd[0]} == "curl" ]]; then
if [[ -n "$output" ]]; then if [[ -n "$output" ]]; then
"${download_cmd[@]}" --output "$output" "$url" || return 1 "${download_cmd[@]}" --output "$output" "$url"
else else
"${download_cmd[@]}" "$url" || return 1 "${download_cmd[@]}" "$url"
fi fi
else else
err "Unsupported download command: ${download_cmd[*]}" err "Unsupported download command: ${download_cmd[*]}"