From be628646ce11b60ff92a61b30953a90a1653bf7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophane=20Hufschmitt?= <7226587+thufschmitt@users.noreply.github.com> Date: Thu, 7 Mar 2024 08:47:58 +0100 Subject: [PATCH] Revert "Fix sudo in the darwin installer (#10128)" This reverts commit 686405ef416955621a89815e07cb64e1ee4f1495. --- scripts/install-multi-user.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/install-multi-user.sh b/scripts/install-multi-user.sh index 4d6a1914e..1dbb93bf9 100644 --- a/scripts/install-multi-user.sh +++ b/scripts/install-multi-user.sh @@ -69,17 +69,16 @@ readonly PROXY_ENVIRONMENT_VARIABLES=( NO_PROXY ) -SUDO_KEPT_ENVIRONMENT_VARIABLES="" +SUDO_EXTRA_ENVIRONMENT_VARIABLES=() setup_sudo_extra_environment_variables() { + local i=${#SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]} for variable in "${PROXY_ENVIRONMENT_VARIABLES[@]}"; do if [ "x${!variable:-}" != "x" ]; then - SUDO_KEPT_ENVIRONMENT_VARIABLES="$SUDO_KEPT_ENVIRONMENT_VARIABLES,$variable" + SUDO_EXTRA_ENVIRONMENT_VARIABLES[i]="$variable=${!variable}" + i=$((i + 1)) fi done - - # Required by the darwin installer - export SUDO_KEPT_ENVIRONMENT_VARIABLES } setup_sudo_extra_environment_variables @@ -387,7 +386,7 @@ _sudo() { if is_root; then env "$@" else - sudo --preserve-env="$SUDO_KEPT_ENVIRONMENT_VARIABLES" "$@" + sudo "${SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]}" "$@" fi }