From 2563b91efb4cba49c1d82f6bc93439e989f90206 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 9 Mar 2015 12:22:58 -0400 Subject: [PATCH] cr-ensure-disk-space: Permit argument to specify local directory. If the argument is Logs rather than LogsPublish (ie, refers to a local directory (without `:') rather than a remote one (with `:'), do things locally (by invoking sh -ec so that we have identical quoting rules to ssh). No effectively functional change with the current configuration. We still always do a local deletion. This is anomalous and will disappear shortly. Signed-off-by: Ian Jackson --- cr-ensure-disk-space | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cr-ensure-disk-space b/cr-ensure-disk-space index 1c665b3..1defa6a 100755 --- a/cr-ensure-disk-space +++ b/cr-ensure-disk-space @@ -53,13 +53,22 @@ our @flights; our @sshopts= qw(-o batchmode=yes); my $cfgvalue = $c{$cfgbase}; -$cgvvalue =~ m/\:/ or die "$c{LogsPublish} ?"; -my ($pubhost, $pubdir) = ($`,$'); #'; + +my ($pubhost, $pubdir); +if ($cfgvalue =~ m/\:/) { + ($pubhost, $pubdir) = ($`,$'); #'); +} else { + ($pubhost, $pubdir) = (undef, $cfgvalue); +} sub ontarget ($) { my ($shellcmd) = @_; # returns list to run that command - return qw(ssh -n), @sshopts, $pubhost, $shellcmd; + if (defined $pubhost) { + return qw(ssh -n), @sshopts, $pubhost, $shellcmd; + } else { + return qw(sh -ec), $shellcmd; + } } for (;;) { -- 2.39.5