mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
nixos-rebuild: add explicit option to enable (remote) sudo
Add --use-remote-sudo option. When set, remote commands will be prefixed with 'sudo'. This allows using sudo remotely _without_ having to use sudo locally (when using --build-host/--taget-host).
This commit is contained in:
parent
d7b18bcb37
commit
2c09cfc097
2 changed files with 19 additions and 4 deletions
|
@ -90,6 +90,11 @@ while [ "$#" -gt 0 ]; do
|
|||
targetHost="$1"
|
||||
shift 1
|
||||
;;
|
||||
--use-remote-sudo)
|
||||
# note the trailing space
|
||||
maybeSudo="sudo "
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
echo "$0: unknown option \`$i'"
|
||||
exit 1
|
||||
|
@ -97,10 +102,6 @@ while [ "$#" -gt 0 ]; do
|
|||
esac
|
||||
done
|
||||
|
||||
if [ -n "$SUDO_USER" ]; then
|
||||
maybeSudo="sudo "
|
||||
fi
|
||||
|
||||
if [ -z "$buildHost" -a -n "$targetHost" ]; then
|
||||
buildHost="$targetHost"
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue