Skip to content

Commit

Permalink
Merge pull request #10070 from ramboman/fix-proxy-installer
Browse files Browse the repository at this point in the history
`install-multi-user.sh`: `_sudo`: add proxy variables to sudo
  • Loading branch information
thufschmitt authored Feb 28, 2024
2 parents bd21b4b + 24fd7e2 commit 90ec015
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion scripts/install-multi-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ readonly EXTRACTED_NIX_PATH="$(dirname "$0")"

readonly ROOT_HOME=~root

readonly PROXY_ENVIRONMENT_VARIABLES=(
http_proxy
https_proxy
ftp_proxy
no_proxy
HTTP_PROXY
HTTPS_PROXY
FTP_PROXY
NO_PROXY
)

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_EXTRA_ENVIRONMENT_VARIABLES[i]="$variable=${!variable}"
i=$((i + 1))
fi
done
}

setup_sudo_extra_environment_variables

if [ -t 0 ] && [ -z "${NIX_INSTALLER_YES:-}" ]; then
readonly IS_HEADLESS='no'
else
Expand Down Expand Up @@ -361,7 +386,7 @@ _sudo() {
if is_root; then
env "$@"
else
sudo "$@"
sudo "${SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]}" "$@"
fi
}

Expand Down

0 comments on commit 90ec015

Please sign in to comment.