1
0
Fork 0
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:
Your Name 2024-03-22 14:37:41 -04:00
parent f95ec69ac1
commit ea5fb3d0eb
3 changed files with 1 additions and 25 deletions

View file

@ -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)
''

View file

@ -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
"$@"

View file

@ -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
}