Unverified Commit b83f8037 authored by Thomas Gleason's avatar Thomas Gleason Committed by GitHub

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

parent 4fef6552
...@@ -423,22 +423,34 @@ get_k3s_selinux_version() { ...@@ -423,22 +423,34 @@ get_k3s_selinux_version() {
# --- download from github url --- # --- download from github url ---
download() { download() {
[ $# -eq 2 ] || fatal 'download needs exactly 2 arguments' [ $# -eq 2 ] || fatal 'download needs exactly 2 arguments'
# Disable exit-on-error so we can do custom error messages on failure
set +e set +e
# Default to a failure status
status=1
case $DOWNLOADER in case $DOWNLOADER in
curl) curl)
curl -o $1 -sfL $2 curl -o $1 -sfL $2
status=$?
;; ;;
wget) wget)
wget -qO $1 $2 wget -qO $1 $2
status=$?
;; ;;
*) *)
# Enable exit-on-error for fatal to execute
set -e
fatal "Incorrect executable '$DOWNLOADER'" fatal "Incorrect executable '$DOWNLOADER'"
;; ;;
esac esac
# Abort if download command failed # Re-enable exit-on-error
[ $? -eq 0 ] || fatal 'Download failed'
set -e set -e
# Abort if download command failed
[ $status -eq 0 ] || fatal 'Download failed'
} }
# --- download hash from github url --- # --- download hash from github url ---
......
afacec791f66d92cec11880479c42b9e261912e0d97d3e3a3de21315b6ac49f3 install.sh f49035378daf603b0dbd458efb4d50608d3499aab3b2e724384dfb5801153669 install.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment