diff options
author | Bjørn Forsman <bjorn.forsman@gmail.com> | 2019-10-23 20:22:39 +0200 |
---|---|---|
committer | Bjørn Forsman <bjorn.forsman@gmail.com> | 2019-11-07 17:03:12 +0100 |
commit | 2c09cfc097daef5b85d21fe906441b5702bb2101 (patch) | |
tree | 2223d4f3e34601cbd6031460d24ba898676d8b56 /nixos/modules | |
parent | d7b18bcb3718c87767619e117e363e830c81913f (diff) | |
download | nixlib-2c09cfc097daef5b85d21fe906441b5702bb2101.tar nixlib-2c09cfc097daef5b85d21fe906441b5702bb2101.tar.gz nixlib-2c09cfc097daef5b85d21fe906441b5702bb2101.tar.bz2 nixlib-2c09cfc097daef5b85d21fe906441b5702bb2101.tar.lz nixlib-2c09cfc097daef5b85d21fe906441b5702bb2101.tar.xz nixlib-2c09cfc097daef5b85d21fe906441b5702bb2101.tar.zst nixlib-2c09cfc097daef5b85d21fe906441b5702bb2101.zip |
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).
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/installer/tools/nixos-rebuild.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/nixos/modules/installer/tools/nixos-rebuild.sh b/nixos/modules/installer/tools/nixos-rebuild.sh index 891f374df536..c53dc1000c4a 100644 --- a/nixos/modules/installer/tools/nixos-rebuild.sh +++ b/nixos/modules/installer/tools/nixos-rebuild.sh @@ -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 |