mirror of
https://github.com/NixOS/nix.git
synced 2024-11-21 22:32:26 +00:00
Revert "Fix sudo in the darwin installer (#10128)"
This reverts commit 686405ef41
.
This commit is contained in:
parent
0a11080c58
commit
be628646ce
@ -69,17 +69,16 @@ readonly PROXY_ENVIRONMENT_VARIABLES=(
|
|||||||
NO_PROXY
|
NO_PROXY
|
||||||
)
|
)
|
||||||
|
|
||||||
SUDO_KEPT_ENVIRONMENT_VARIABLES=""
|
SUDO_EXTRA_ENVIRONMENT_VARIABLES=()
|
||||||
|
|
||||||
setup_sudo_extra_environment_variables() {
|
setup_sudo_extra_environment_variables() {
|
||||||
|
local i=${#SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]}
|
||||||
for variable in "${PROXY_ENVIRONMENT_VARIABLES[@]}"; do
|
for variable in "${PROXY_ENVIRONMENT_VARIABLES[@]}"; do
|
||||||
if [ "x${!variable:-}" != "x" ]; then
|
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
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Required by the darwin installer
|
|
||||||
export SUDO_KEPT_ENVIRONMENT_VARIABLES
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_sudo_extra_environment_variables
|
setup_sudo_extra_environment_variables
|
||||||
@ -387,7 +386,7 @@ _sudo() {
|
|||||||
if is_root; then
|
if is_root; then
|
||||||
env "$@"
|
env "$@"
|
||||||
else
|
else
|
||||||
sudo --preserve-env="$SUDO_KEPT_ENVIRONMENT_VARIABLES" "$@"
|
sudo "${SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]}" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user