@ -17,8 +17,7 @@
# The install script is based off of the MIT-licensed script from glide,
# The install script is based off of the MIT-licensed script from glide,
# the package manager for Go: https://github.com/Masterminds/glide.sh/blob/master/get
# the package manager for Go: https://github.com/Masterminds/glide.sh/blob/master/get
PROJECT_NAME="helm"
: ${BINARY_NAME:="helm"}
: ${USE_SUDO:="true"}
: ${USE_SUDO:="true"}
: ${HELM_INSTALL_DIR:="/usr/local/bin"}
: ${HELM_INSTALL_DIR:="/usr/local/bin"}
@ -92,8 +91,8 @@ checkDesiredVersion() {
# checkHelmInstalledVersion checks which version of helm is installed and
# checkHelmInstalledVersion checks which version of helm is installed and
# if it needs to be changed.
# if it needs to be changed.
checkHelmInstalledVersion() {
checkHelmInstalledVersion() {
if [[ -f "${HELM_INSTALL_DIR}/${PROJECT _NAME}" ]]; then
if [[ -f "${HELM_INSTALL_DIR}/${BINARY _NAME}" ]]; then
local version=$("${HELM_INSTALL_DIR}/${PROJECT _NAME}" version --template="{{ .Version }}")
local version=$("${HELM_INSTALL_DIR}/${BINARY _NAME}" version --template="{{ .Version }}")
if [[ "$version" == "$TAG" ]]; then
if [[ "$version" == "$TAG" ]]; then
echo "Helm ${version} is already ${DESIRED_VERSION:-latest}"
echo "Helm ${version} is already ${DESIRED_VERSION:-latest}"
return 0
return 0
@ -131,7 +130,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="$HELM_TMP_ROOT/$PROJECT _NAME"
HELM_TMP="$HELM_TMP_ROOT/$BINARY _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
@ -141,10 +140,10 @@ installFile() {
mkdir -p "$HELM_TMP"
mkdir -p "$HELM_TMP"
tar xf "$HELM_TMP_FILE" -C "$HELM_TMP"
tar xf "$HELM_TMP_FILE" -C "$HELM_TMP"
HELM_TMP_BIN="$HELM_TMP/$OS-$ARCH/$PROJECT_NAME "
HELM_TMP_BIN="$HELM_TMP/$OS-$ARCH/helm "
echo "Preparing to install $PROJECT _NAME into ${HELM_INSTALL_DIR}"
echo "Preparing to install $BINARY _NAME into ${HELM_INSTALL_DIR}"
runAsRoot cp "$HELM_TMP_BIN" "$HELM_INSTALL_DIR"
runAsRoot cp "$HELM_TMP_BIN" "$HELM_INSTALL_DIR/$BINARY_NAME "
echo "$PROJECT_NAME installed into $HELM_INSTALL_DIR/$PROJECT _NAME"
echo "$BINARY_NAME installed into $HELM_INSTALL_DIR/$BINARY _NAME"
}
}
# fail_trap is executed if an error occurs.
# fail_trap is executed if an error occurs.
@ -152,10 +151,10 @@ fail_trap() {
result=$?
result=$?
if [ "$result" != "0" ]; then
if [ "$result" != "0" ]; then
if [[ -n "$INPUT_ARGUMENTS" ]]; then
if [[ -n "$INPUT_ARGUMENTS" ]]; then
echo "Failed to install $PROJECT _NAME with the arguments provided: $INPUT_ARGUMENTS"
echo "Failed to install $BINARY _NAME with the arguments provided: $INPUT_ARGUMENTS"
help
help
else
else
echo "Failed to install $PROJECT _NAME"
echo "Failed to install $BINARY _NAME"
fi
fi
echo -e "\tFor support, go to https://github.com/helm/helm."
echo -e "\tFor support, go to https://github.com/helm/helm."
fi
fi
@ -166,9 +165,9 @@ fail_trap() {
# testVersion tests the installed client to make sure it is working.
# testVersion tests the installed client to make sure it is working.
testVersion() {
testVersion() {
set +e
set +e
HELM="$(which $PROJECT _NAME)"
HELM="$(which $BINARY _NAME)"
if [ "$?" = "1" ]; then
if [ "$?" = "1" ]; then
echo "$PROJECT _NAME not found. Is $HELM_INSTALL_DIR on your "'$PATH?'
echo "$BINARY _NAME not found. Is $HELM_INSTALL_DIR on your "'$PATH?'
exit 1
exit 1
fi
fi
set -e
set -e