diff --git a/scripts/get-helm-3 b/scripts/get-helm-3 index 31678a177..f809ece94 100755 --- a/scripts/get-helm-3 +++ b/scripts/get-helm-3 @@ -25,6 +25,8 @@ : ${HELM_INSTALL_DIR:="/usr/local/bin"} : ${GPG_PUBRING:="pubring.kbx"} +EXIT_VERIFY_FAILED=2 + HAS_CURL="$(type "curl" &> /dev/null && echo true || echo false)" HAS_WGET="$(type "wget" &> /dev/null && echo true || echo false)" HAS_OPENSSL="$(type "openssl" &> /dev/null && echo true || echo false)" @@ -72,30 +74,30 @@ verifySupported() { if ! echo "${supported}" | grep -q "${OS}-${ARCH}"; then echo "No prebuilt binary for ${OS}-${ARCH}." echo "To build from source, go to https://github.com/helm/helm" - exit 1 + exit $EXIT_VERIFY_FAILED fi if [ "${HAS_CURL}" != "true" ] && [ "${HAS_WGET}" != "true" ]; then echo "Either curl or wget is required" - exit 1 + exit $EXIT_VERIFY_FAILED fi if [ "${VERIFY_CHECKSUM}" == "true" ] && [ "${HAS_OPENSSL}" != "true" ]; then echo "In order to verify checksum, openssl must first be installed." echo "Please install openssl or set VERIFY_CHECKSUM=false in your environment." - exit 1 + exit $EXIT_VERIFY_FAILED fi if [ "${VERIFY_SIGNATURES}" == "true" ]; then if [ "${HAS_GPG}" != "true" ]; then echo "In order to verify signatures, gpg must first be installed." echo "Please install gpg or set VERIFY_SIGNATURES=false in your environment." - exit 1 + exit $EXIT_VERIFY_FAILED fi if [ "${OS}" != "linux" ]; then echo "Signature verification is currently only supported on Linux." echo "Please set VERIFY_SIGNATURES=false or verify the signatures manually." - exit 1 + exit $EXIT_VERIFY_FAILED fi fi @@ -246,7 +248,9 @@ verifySignatures() { fail_trap() { result=$? if [ "$result" != "0" ]; then - if [[ -n "$INPUT_ARGUMENTS" ]]; then + if [[ "$result" = "$EXIT_VERIFY_FAILED" ]]; then + echo "The script failed the installation parameter validation" + elif [[ -n "$INPUT_ARGUMENTS" ]]; then echo "Failed to install $BINARY_NAME with the arguments provided: $INPUT_ARGUMENTS" help else