aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/krops/default.nix2
-rw-r--r--pkgs/populate/default.nix10
2 files changed, 8 insertions, 4 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix
index 13de4ce..e72e94c 100644
--- a/pkgs/krops/default.nix
+++ b/pkgs/krops/default.nix
@@ -26,7 +26,7 @@ in
"-p" target.port
"-t"
target.host
- command
+ (if target.sudo then command else "sudo ${command}")
];
};
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index 1367a50..8a383b1 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -157,6 +157,7 @@ let
fi
${rsync}/bin/rsync \
${optionalString (config.useChecksum or false) /* sh */ "--checksum"} \
+ ${optionalString target.sudo /* sh */ "--rsync-path=\"sudo rsync\""} \
-e ${quote (ssh' target)} \
-vFrlptD \
--delete-excluded \
@@ -172,9 +173,12 @@ let
shell' = target: script:
if isLocalTarget target
then script
- else /* sh */ ''
- ${ssh' target} ${quote target.host} ${quote script}
- '';
+ else
+ if target.sudo then /* sh */ ''
+ ${ssh' target} ${quote target.host} ${quote "sudo bash -c ${quote script}"}
+ '' else ''
+ ${ssh' target} ${quote target.host} ${quote script}
+ '';
ssh' = target: concatMapStringsSep " " quote [
"${openssh}/bin/ssh"