From f95e0d6aefd869d7c5e15032e72d5365499cd436 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 17 Jul 2016 01:21:38 +0200 Subject: add flag to override ssh command --- bin/populate | 5 +++++ lib/populate.jq | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/populate b/bin/populate index bbe3b7a..fdc4c5d 100755 --- a/bin/populate +++ b/bin/populate @@ -10,6 +10,7 @@ debug=false force=false origin_host=${HOSTNAME-cat /proc/sys/kernel/hostname} origin_user=$LOGNAME +ssh_cmd=ssh target_spec= @@ -28,6 +29,9 @@ for arg; do --force) force=true ;; + --ssh=*) + ssh_cmd=${arg#--ssh=} + ;; -*) error "bad argument: $arg" ;; @@ -52,6 +56,7 @@ fi script=$(jq -e -r \ --argjson use_force "$force" \ + --arg ssh_cmd "$ssh_cmd" \ --arg target_spec "$target_spec" \ --arg origin_host "$origin_host" \ --arg origin_user "$origin_user" \ diff --git a/lib/populate.jq b/lib/populate.jq index 23e16e8..fa13795 100644 --- a/lib/populate.jq +++ b/lib/populate.jq @@ -97,7 +97,7 @@ def rsync_script: # ControlPersist=no so we reuse existing control sockets but if we # create a new one, then remove it immediately after we are done so # this script does not hang. - @sh " -e \("ssh -o ControlPersist=no -p \($target.port)") \\", + @sh " -e \("\($ssh_cmd) -o ControlPersist=no -p \($target.port)") \\", @sh " \($target.user)@\($target.host):\($target.path)" end); @@ -112,7 +112,7 @@ def compile: def ssh_target: @sh "echo \(compile) \\", - @sh " | ssh \($target.user)@\($target.host) -p \($target.port) -T"; + @sh " | \($ssh_cmd) \($target.user)@\($target.host) -p \($target.port) -T"; [ -- cgit v1.2.3