Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow install script to print error on failed binary download #11335

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -423,22 +423,34 @@ get_k3s_selinux_version() {
# --- download from github url ---
download() {
[ $# -eq 2 ] || fatal 'download needs exactly 2 arguments'

# Disable exit-on-error so we can do custom error messages on failure
set +e

# Default to a failure status
status=1

case $DOWNLOADER in
curl)
curl -o $1 -sfL $2
status=$?
;;
wget)
wget -qO $1 $2
status=$?
;;
*)
# Enable exit-on-error for fatal to execute
set -e
fatal "Incorrect executable '$DOWNLOADER'"
;;
esac

# Abort if download command failed
[ $? -eq 0 ] || fatal 'Download failed'
# Re-enable exit-on-error
set -e

# Abort if download command failed
[ $status -eq 0 ] || fatal 'Download failed'
}

# --- download hash from github url ---
Expand Down
2 changes: 1 addition & 1 deletion install.sh.sha256sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
afacec791f66d92cec11880479c42b9e261912e0d97d3e3a3de21315b6ac49f3 install.sh
f49035378daf603b0dbd458efb4d50608d3499aab3b2e724384dfb5801153669 install.sh
Loading