mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Allow sudo
alternatives when installing from tarball
This commit is contained in:
parent
04975f7c32
commit
e83481f5a8
1 changed files with 4 additions and 3 deletions
|
@ -9,6 +9,8 @@ self="$(dirname "$0")"
|
||||||
nix="@nix@"
|
nix="@nix@"
|
||||||
cacert="@cacert@"
|
cacert="@cacert@"
|
||||||
|
|
||||||
|
# allow to override identity change command
|
||||||
|
readonly NIX_BECOME="${NIX_BECOME:-sudo}"
|
||||||
|
|
||||||
if ! [ -e "$self/.reginfo" ]; then
|
if ! [ -e "$self/.reginfo" ]; then
|
||||||
echo "$0: incomplete installer (.reginfo is missing)" >&2
|
echo "$0: incomplete installer (.reginfo is missing)" >&2
|
||||||
|
@ -63,7 +65,6 @@ while [ $# -gt 0 ]; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
INSTALL_MODE=no-daemon
|
INSTALL_MODE=no-daemon
|
||||||
# intentional tail space
|
|
||||||
ACTION=install
|
ACTION=install
|
||||||
;;
|
;;
|
||||||
--yes)
|
--yes)
|
||||||
|
@ -135,8 +136,8 @@ echo "performing a single-user installation of Nix..." >&2
|
||||||
|
|
||||||
if ! [ -e "$dest" ]; then
|
if ! [ -e "$dest" ]; then
|
||||||
cmd="mkdir -m 0755 $dest && chown $USER $dest"
|
cmd="mkdir -m 0755 $dest && chown $USER $dest"
|
||||||
echo "directory $dest does not exist; creating it by running '$cmd' using sudo" >&2
|
echo "directory $dest does not exist; creating it by running '$cmd' using $NIX_BECOME" >&2
|
||||||
if ! sudo sh -c "$cmd"; then
|
if ! $NIX_BECOME sh -c "$cmd"; then
|
||||||
echo "$0: please manually run '$cmd' as root to create $dest" >&2
|
echo "$0: please manually run '$cmd' as root to create $dest" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue