From 1832d525b0690de34c03b1c8d953c7d82b72755d Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Tue, 18 Sep 2018 06:13:32 +0900 Subject: [PATCH] Add --no-sudo option (#4649) Signed-off-by: Yuya Takeyama --- scripts/get | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/get b/scripts/get index 29cd47e1a..326660a89 100755 --- a/scripts/get +++ b/scripts/get @@ -18,6 +18,7 @@ # the package manager for Go: https://github.com/Masterminds/glide.sh/blob/master/get PROJECT_NAME="helm" +USE_SUDO="true" : ${HELM_INSTALL_DIR:="/usr/local/bin"} @@ -50,7 +51,7 @@ initOS() { runAsRoot() { local CMD="$*" - if [ $EUID -ne 0 ]; then + if [ $EUID -ne 0 -a $USE_SUDO = "true" ]; then CMD="sudo $CMD" fi @@ -180,6 +181,7 @@ help () { echo -e "\t[--help|-h ] ->> prints this help" echo -e "\t[--version|-v ] . When not defined it defaults to latest" echo -e "\te.g. --version v2.4.0 or -v latest" + echo -e "\t[--no-sudo] ->> install without sudo" } # cleanup temporary files to avoid https://github.com/helm/helm/issues/2977 @@ -209,6 +211,9 @@ while [[ $# -gt 0 ]]; do exit 0 fi ;; + '--no-sudo') + USE_SUDO="false" + ;; '--help'|-h) help exit 0