aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-06-08 23:11:36 +0200
committertv <tv@krebsco.de>2020-06-08 23:12:14 +0200
commit44e8dd5cea9cdae04eecd7e15cdfc45a96643cd5 (patch)
tree7d9675310a3ddbb092c4dfb0ea811f761130a22b /pkgs/populate
parent1eb67a9b78f5e648fc9e399ac3649365f40b559f (diff)
treewide: harmonize ssh callsv1.22.0
Diffstat (limited to 'pkgs/populate')
-rw-r--r--pkgs/populate/default.nix23
1 files changed, 11 insertions, 12 deletions
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index 36a97b3..40c37e3 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -6,7 +6,7 @@ with shell;
let
check = { force, target }: let
sentinelFile = "${target.path}/.populate";
- in shell' target /* sh */ ''
+ in runShell target /* sh */ ''
${optionalString force /* sh */ ''
mkdir -vp ${quote (dirOf sentinelFile)} >&2
touch ${quote sentinelFile}
@@ -23,7 +23,7 @@ let
do-backup = { target }: let
sentinelFile = "${target.path}/.populate";
in
- shell' target /* sh */ ''
+ runShell target /* sh */ ''
if ! test -d ${quote sentinelFile}; then
>&2 printf 'error" sentinel file is not a directory: %s\n' ${quote (
optionalString (!isLocalTarget target) "${target.host}:" +
@@ -40,7 +40,7 @@ let
${target.path}/.populate/backup/
'';
- pop.derivation = target: source: shell' target /* sh */ ''
+ pop.derivation = target: source: runShell target /* sh */ ''
nix-build -E ${quote source.text} -o ${quote target.path} >&2
'';
@@ -50,7 +50,7 @@ let
in
rsync' target config (quote source.path);
- pop.git = target: source: shell' target /* sh */ ''
+ pop.git = target: source: runShell target /* sh */ ''
set -efu
if ! test -e ${quote target.path}; then
git clone --recurse-submodules ${quote source.url} ${quote target.path}
@@ -92,7 +92,7 @@ let
if test -e ${quote source.dir}/.git; then
local_pass_info=${quote source.name}\ $(${git}/bin/git -C ${quote source.dir} log -1 --format=%H ${quote source.name})
- remote_pass_info=$(${shell' target /* sh */ ''
+ remote_pass_info=$(${runShell target /* sh */ ''
cat ${quote target.path}/.pass_info || :
''})
@@ -133,12 +133,12 @@ let
pop.pipe = target: source: /* sh */ ''
${quote source.command} | {
- ${shell' target /* sh */ "cat > ${quote target.path}"}
+ ${runShell target /* sh */ "cat > ${quote target.path}"}
}
'';
# TODO rm -fR instead of ln -f?
- pop.symlink = target: source: shell' target /* sh */ ''
+ pop.symlink = target: source: runShell target /* sh */ ''
ln -fnsT ${quote source.target} ${quote target.path}
'';
@@ -178,20 +178,19 @@ let
>&2
'';
- shell' = target: script:
+ runShell = target: command:
if isLocalTarget target
- then script
+ then command
else
if target.sudo then /* sh */ ''
- ${ssh' target} ${quote target.host} ${quote "sudo bash -c ${quote script}"}
+ ${ssh' target} ${quote target.host} ${quote "sudo bash -c ${quote command}"}
'' else ''
- ${ssh' target} ${quote target.host} ${quote script}
+ ${ssh' target} ${quote target.host} ${quote command}
'';
ssh' = target: concatMapStringsSep " " quote (flatten [
"${openssh}/bin/ssh"
(optionals (target.user != "") ["-l" target.user])
- "-o" "ControlPersist=no"
"-p" target.port
"-T"
target.extraOptions