mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Fix sudo in the darwin installer (#10128)
This commit is contained in:
parent
67f95755d6
commit
686405ef41
1 changed files with 6 additions and 5 deletions
|
@ -69,16 +69,17 @@ readonly PROXY_ENVIRONMENT_VARIABLES=(
|
||||||
NO_PROXY
|
NO_PROXY
|
||||||
)
|
)
|
||||||
|
|
||||||
SUDO_EXTRA_ENVIRONMENT_VARIABLES=()
|
SUDO_KEPT_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_EXTRA_ENVIRONMENT_VARIABLES[i]="$variable=${!variable}"
|
SUDO_KEPT_ENVIRONMENT_VARIABLES="$SUDO_KEPT_ENVIRONMENT_VARIABLES,$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
|
||||||
|
@ -386,7 +387,7 @@ _sudo() {
|
||||||
if is_root; then
|
if is_root; then
|
||||||
env "$@"
|
env "$@"
|
||||||
else
|
else
|
||||||
sudo "${SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]}" "$@"
|
sudo --preserve-env="$SUDO_KEPT_ENVIRONMENT_VARIABLES" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue