From 784782013a11c5f1640fb454ec7b9ea0fbf2c389 Mon Sep 17 00:00:00 2001 From: Michael Musenbrock Date: Tue, 9 Feb 2021 10:47:27 +0100 Subject: [PATCH] fix(helm): get/get-helm-3 whitespace support in runAsRoot When `get`/`get-helm-3` is run with a HELM_INSTALL_DIR containing spaces, the installation fails. Closes #9346 Signed-off-by: Michael Musenbrock --- scripts/get | 10 ++++------ scripts/get-helm-3 | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/get b/scripts/get index 777a53bbc..a8ec3c6d9 100755 --- a/scripts/get +++ b/scripts/get @@ -50,13 +50,11 @@ initOS() { # runs the given command as root (detects if we are root already) runAsRoot() { - local CMD="$*" - - if [ $EUID -ne 0 -a $USE_SUDO = "true" ]; then - CMD="sudo $CMD" + if [ $EUID -ne 0 -a "$USE_SUDO" = "true" ]; then + sudo "${@}" + else + "${@}" fi - - $CMD } # verifySupported checks that the os/arch combination is supported for diff --git a/scripts/get-helm-3 b/scripts/get-helm-3 index 7afa9bae9..97ebe2435 100755 --- a/scripts/get-helm-3 +++ b/scripts/get-helm-3 @@ -57,13 +57,11 @@ initOS() { # runs the given command as root (detects if we are root already) runAsRoot() { - local CMD="$*" - - if [ $EUID -ne 0 -a $USE_SUDO = "true" ]; then - CMD="sudo $CMD" + if [ $EUID -ne 0 -a "$USE_SUDO" = "true" ]; then + sudo "${@}" + else + "${@}" fi - - $CMD } # verifySupported checks that the os/arch combination is supported for