mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
nixos-rebuild: add --no-ssh-tty flag (#339388)
This commit is contained in:
commit
6f1890f3e6
@ -36,6 +36,7 @@ _nixos-rebuild() {
|
|||||||
--rollback
|
--rollback
|
||||||
--specialisation -c # name
|
--specialisation -c # name
|
||||||
--use-remote-sudo
|
--use-remote-sudo
|
||||||
|
--no-ssh-tty
|
||||||
--build-host # host
|
--build-host # host
|
||||||
--target-host # host
|
--target-host # host
|
||||||
# Used with list-generations
|
# Used with list-generations
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
.Op Fl -build-host Va host
|
.Op Fl -build-host Va host
|
||||||
.Op Fl -target-host Va host
|
.Op Fl -target-host Va host
|
||||||
.Op Fl -use-remote-sudo
|
.Op Fl -use-remote-sudo
|
||||||
|
.Op Fl -no-ssh-tty
|
||||||
.br
|
.br
|
||||||
.Op Fl -verbose | v
|
.Op Fl -verbose | v
|
||||||
.Op Fl -quiet
|
.Op Fl -quiet
|
||||||
@ -392,6 +393,16 @@ system with
|
|||||||
.Ic sudo Ns
|
.Ic sudo Ns
|
||||||
\&. Setting this option allows deploying as a non-root user.
|
\&. Setting this option allows deploying as a non-root user.
|
||||||
.
|
.
|
||||||
|
.It Fl -no-ssh-tty
|
||||||
|
When set, nixos-rebuild will not request a tty when executing commands on the
|
||||||
|
.Fl -target-host
|
||||||
|
system with
|
||||||
|
.Ic ssh Ns
|
||||||
|
\&. This may help avoid corrupted terminal output when running multiple
|
||||||
|
nixos-rebuild commands in parallel, but may also prevent the remote
|
||||||
|
.Ic sudo
|
||||||
|
from working properly.
|
||||||
|
.
|
||||||
.It Fl -file Ar path , Fl f Ar path
|
.It Fl -file Ar path , Fl f Ar path
|
||||||
Enable and build the NixOS system from the specified file. The file must
|
Enable and build the NixOS system from the specified file. The file must
|
||||||
evaluate to an attribute set, and it must contain a valid NixOS configuration
|
evaluate to an attribute set, and it must contain a valid NixOS configuration
|
||||||
|
@ -32,6 +32,7 @@ specialisation=
|
|||||||
buildHost=
|
buildHost=
|
||||||
targetHost=
|
targetHost=
|
||||||
remoteSudo=
|
remoteSudo=
|
||||||
|
noSSHTTY=
|
||||||
verboseScript=
|
verboseScript=
|
||||||
noFlake=
|
noFlake=
|
||||||
attr=
|
attr=
|
||||||
@ -163,6 +164,9 @@ while [ "$#" -gt 0 ]; do
|
|||||||
--use-remote-sudo)
|
--use-remote-sudo)
|
||||||
remoteSudo=1
|
remoteSudo=1
|
||||||
;;
|
;;
|
||||||
|
--no-ssh-tty)
|
||||||
|
noSSHTTY=1
|
||||||
|
;;
|
||||||
--flake)
|
--flake)
|
||||||
flake="$1"
|
flake="$1"
|
||||||
shift 1
|
shift 1
|
||||||
@ -238,12 +242,18 @@ targetHostCmd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
targetHostSudoCmd() {
|
targetHostSudoCmd() {
|
||||||
|
local t=
|
||||||
|
if [[ ! "${noSSHTTY:-x}" = 1 ]]; then
|
||||||
|
t="-t"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$remoteSudo" ]; then
|
if [ -n "$remoteSudo" ]; then
|
||||||
useSudo=1 SSHOPTS="$SSHOPTS -t" targetHostCmd "$@"
|
useSudo=1 SSHOPTS="$SSHOPTS $t" targetHostCmd "$@"
|
||||||
else
|
else
|
||||||
# While a tty might not be necessary, we apply it to be consistent with
|
# While a tty might not be necessary, we apply it to be consistent with
|
||||||
# sudo usage, and an experience that is more consistent with local deployment.
|
# sudo usage, and an experience that is more consistent with local deployment.
|
||||||
SSHOPTS="$SSHOPTS -t" targetHostCmd "$@"
|
# But if the user really doesn't want it, don't do it.
|
||||||
|
SSHOPTS="$SSHOPTS $t" targetHostCmd "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user