Add --no-sudo option (#4649)

Signed-off-by: Yuya Takeyama <sign.of.the.wolf.pentagram@gmail.com>
pull/4648/head
Yuya Takeyama 6 years ago committed by Matthew Fisher
parent 7b821dd52f
commit 1832d525b0

@ -18,6 +18,7 @@
# 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" PROJECT_NAME="helm"
USE_SUDO="true"
: ${HELM_INSTALL_DIR:="/usr/local/bin"} : ${HELM_INSTALL_DIR:="/usr/local/bin"}
@ -50,7 +51,7 @@ initOS() {
runAsRoot() { runAsRoot() {
local CMD="$*" local CMD="$*"
if [ $EUID -ne 0 ]; then if [ $EUID -ne 0 -a $USE_SUDO = "true" ]; then
CMD="sudo $CMD" CMD="sudo $CMD"
fi fi
@ -180,6 +181,7 @@ help () {
echo -e "\t[--help|-h ] ->> prints this help" echo -e "\t[--help|-h ] ->> prints this help"
echo -e "\t[--version|-v <desired_version>] . When not defined it defaults to latest" echo -e "\t[--version|-v <desired_version>] . When not defined it defaults to latest"
echo -e "\te.g. --version v2.4.0 or -v 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 # cleanup temporary files to avoid https://github.com/helm/helm/issues/2977
@ -209,6 +211,9 @@ while [[ $# -gt 0 ]]; do
exit 0 exit 0
fi fi
;; ;;
'--no-sudo')
USE_SUDO="false"
;;
'--help'|-h) '--help'|-h)
help help
exit 0 exit 0

Loading…
Cancel
Save