mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Replace in-sudo
with env
`(env)[22c8c23f40/src/env.c (L53)
]` seems to supports equal strings since before 2016.
This commit is contained in:
parent
f95ec69ac1
commit
ea5fb3d0eb
|
@ -23,7 +23,6 @@ in
|
|||
runCommand "nix-binary-tarball-${version}" env ''
|
||||
cp ${installerClosureInfo}/registration $TMPDIR/reginfo
|
||||
cp ${./create-darwin-volume.sh} $TMPDIR/create-darwin-volume.sh
|
||||
cp ${./in-sudo.sh} $TMPDIR/in-sudo
|
||||
substitute ${./install-nix-from-closure.sh} $TMPDIR/install \
|
||||
--subst-var-by nix ${nix} \
|
||||
--subst-var-by cacert ${cacert}
|
||||
|
@ -45,7 +44,6 @@ runCommand "nix-binary-tarball-${version}" env ''
|
|||
shellcheck $TMPDIR/create-darwin-volume.sh
|
||||
shellcheck $TMPDIR/install-darwin-multi-user.sh
|
||||
shellcheck $TMPDIR/install-systemd-multi-user.sh
|
||||
shellcheck $TMPDIR/in-sudo
|
||||
|
||||
# SC1091: Don't panic about not being able to source
|
||||
# /etc/profile
|
||||
|
@ -63,7 +61,6 @@ runCommand "nix-binary-tarball-${version}" env ''
|
|||
chmod +x $TMPDIR/install-darwin-multi-user.sh
|
||||
chmod +x $TMPDIR/install-systemd-multi-user.sh
|
||||
chmod +x $TMPDIR/install-multi-user
|
||||
chmod +x $TMPDIR/in-sudo
|
||||
dir=nix-${version}-${system}
|
||||
fn=$out/$dir.tar.xz
|
||||
mkdir -p $out/nix-support
|
||||
|
@ -82,7 +79,6 @@ runCommand "nix-binary-tarball-${version}" env ''
|
|||
$TMPDIR/install-darwin-multi-user.sh \
|
||||
$TMPDIR/install-systemd-multi-user.sh \
|
||||
$TMPDIR/install-multi-user \
|
||||
$TMPDIR/in-sudo \
|
||||
$TMPDIR/reginfo \
|
||||
$(cat ${installerClosureInfo}/store-paths)
|
||||
''
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
export_equal_string() {
|
||||
local equal_string=$1
|
||||
|
||||
local variable_name value
|
||||
IFS='=' read -r -d $'\0' variable_name value <<< "$equal_string"
|
||||
value=${value:0:-1}
|
||||
eval "export $variable_name=$(printf '%q' "$value")"
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
*=*) export_equal_string "$1"; shift ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@"
|
|
@ -58,7 +58,6 @@ readonly EXTRACTED_NIX_PATH="$(dirname "$0")"
|
|||
|
||||
readonly ROOT_HOME=~root
|
||||
|
||||
readonly IN_SUDO=$EXTRACTED_NIX_PATH/in-sudo
|
||||
readonly PROXY_ENVIRONMENT_VARIABLES=(
|
||||
http_proxy
|
||||
https_proxy
|
||||
|
@ -387,7 +386,7 @@ _sudo() {
|
|||
if is_root; then
|
||||
env "$@"
|
||||
else
|
||||
sudo "$IN_SUDO" "${SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]}" "$@"
|
||||
sudo env "${SUDO_EXTRA_ENVIRONMENT_VARIABLES[@]}" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue