Skip to content

Commit

Permalink
nixos-rebuild: fix entering sudo password over SSH
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzime committed Dec 30, 2023
1 parent d147d22 commit 053906e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkgs/os-specific/linux/nixos-rebuild/nixos-rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ done

sudoCommand=(sudo --preserve-env="$preservedSudoVars" --)

if [[ -n "$SUDO_USER" || -n "$remoteSudoAlways" ]]; then
if [[ -n "$SUDO_USER" ]]; then
maybeSudo=("${sudoCommand[@]}")
fi

if [[ -n "$remoteSudoAlways" ]]; then
maybeSudo=(-t "${sudoComand[@]}")
fi

# log the given argument to stderr if verbose mode is on
logVerbose() {
if [ -n "$verboseScript" ]; then
Expand Down Expand Up @@ -200,7 +204,7 @@ targetHostCmd() {

targetHostSudoCmd() {
if [[ -n "$remoteSudo" ]]; then
maybeSudo=("${sudoCommand[@]}")
maybeSudo=(-t "${sudoCommand[@]}")
fi

targetHostCmd "$@"
Expand Down

0 comments on commit 053906e

Please sign in to comment.