|
|
@ -111,8 +111,10 @@ downloadFile() {
|
|
|
|
HELM_DIST="helm-$TAG-$OS-$ARCH.tar.gz"
|
|
|
|
HELM_DIST="helm-$TAG-$OS-$ARCH.tar.gz"
|
|
|
|
DOWNLOAD_URL="https://kubernetes-helm.storage.googleapis.com/$HELM_DIST"
|
|
|
|
DOWNLOAD_URL="https://kubernetes-helm.storage.googleapis.com/$HELM_DIST"
|
|
|
|
CHECKSUM_URL="$DOWNLOAD_URL.sha256"
|
|
|
|
CHECKSUM_URL="$DOWNLOAD_URL.sha256"
|
|
|
|
HELM_TMP_FILE="/tmp/$HELM_DIST"
|
|
|
|
HELM_TMP_ROOT="/tmp/$(whoami)"
|
|
|
|
HELM_SUM_FILE="/tmp/$HELM_DIST.sha256"
|
|
|
|
HELM_TMP_FILE="$HELM_TMP_ROOT/$HELM_DIST"
|
|
|
|
|
|
|
|
HELM_SUM_FILE="$HELM_TMP_ROOT/$HELM_DIST.sha256"
|
|
|
|
|
|
|
|
mkdir -p "$HELM_TMP_ROOT"
|
|
|
|
echo "Downloading $DOWNLOAD_URL"
|
|
|
|
echo "Downloading $DOWNLOAD_URL"
|
|
|
|
if type "curl" > /dev/null; then
|
|
|
|
if type "curl" > /dev/null; then
|
|
|
|
curl -SsL "$CHECKSUM_URL" -o "$HELM_SUM_FILE"
|
|
|
|
curl -SsL "$CHECKSUM_URL" -o "$HELM_SUM_FILE"
|
|
|
@ -129,7 +131,7 @@ downloadFile() {
|
|
|
|
# installFile verifies the SHA256 for the file, then unpacks and
|
|
|
|
# installFile verifies the SHA256 for the file, then unpacks and
|
|
|
|
# installs it.
|
|
|
|
# installs it.
|
|
|
|
installFile() {
|
|
|
|
installFile() {
|
|
|
|
HELM_TMP="/tmp/$PROJECT_NAME"
|
|
|
|
HELM_TMP="$HELM_TMP_ROOT/$PROJECT_NAME"
|
|
|
|
local sum=$(openssl sha1 -sha256 ${HELM_TMP_FILE} | awk '{print $2}')
|
|
|
|
local sum=$(openssl sha1 -sha256 ${HELM_TMP_FILE} | awk '{print $2}')
|
|
|
|
local expected_sum=$(cat ${HELM_SUM_FILE})
|
|
|
|
local expected_sum=$(cat ${HELM_SUM_FILE})
|
|
|
|
if [ "$sum" != "$expected_sum" ]; then
|
|
|
|
if [ "$sum" != "$expected_sum" ]; then
|
|
|
@ -156,6 +158,7 @@ fail_trap() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo -e "\tFor support, go to https://github.com/kubernetes/helm."
|
|
|
|
echo -e "\tFor support, go to https://github.com/kubernetes/helm."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
cleanup
|
|
|
|
exit $result
|
|
|
|
exit $result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -180,6 +183,11 @@ help () {
|
|
|
|
echo -e "\te.g. --version v2.4.0 or -v latest"
|
|
|
|
echo -e "\te.g. --version v2.4.0 or -v latest"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# cleanup temporary files to avoid https://github.com/kubernetes/helm/issues/2977
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
|
|
|
|
rm -rf "$HELM_TMP_ROOT"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Execution
|
|
|
|
# Execution
|
|
|
|
|
|
|
|
|
|
|
|
#Stop execution on any error
|
|
|
|
#Stop execution on any error
|
|
|
@ -200,7 +208,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
'--help'|-h)
|
|
|
|
'--help'|-h)
|
|
|
|
help
|
|
|
|
help
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
;;
|
|
|
@ -220,3 +228,4 @@ if ! checkHelmInstalledVersion; then
|
|
|
|
installFile
|
|
|
|
installFile
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
testVersion
|
|
|
|
testVersion
|
|
|
|
|
|
|
|
cleanup
|
|
|
|