Added
Link Here
|
1 |
--- zetaback.in.orig 2020-05-02 21:18:03 UTC |
2 |
+++ zetaback.in |
3 |
@@ -769,7 +769,11 @@ sub zfs_remove_snap($$$) { |
4 |
} |
5 |
return unless($snap); |
6 |
print "Dropping $snap on $fs\n" if($DEBUG); |
7 |
- `ssh $ssh_config $host $agent -z $fs -d $snap`; |
8 |
+ if ($host eq "localhost") { |
9 |
+ `$agent -z $fs -d $snap`; |
10 |
+ } else { |
11 |
+ `ssh $ssh_config $host $agent -z $fs -d $snap`; |
12 |
+ } |
13 |
} |
14 |
|
15 |
# Lots of args.. internally called. |
16 |
@@ -832,7 +836,12 @@ sub zfs_do_backup($$$$$$;$) { |
17 |
die "Child exit value: $ev" if ($ev); |
18 |
} |
19 |
else { |
20 |
- my @cmd = ('ssh', split(/ /, $ssh_config), $host, $agent, '-z', $fs); |
21 |
+ my @cmd; |
22 |
+ if ($host eq "localhost") { |
23 |
+ @cmd = ($agent, '-z', $fs); |
24 |
+ } else { |
25 |
+ @cmd = ('ssh', split(/ /, $ssh_config), $host, $agent, '-z', $fs); |
26 |
+ } |
27 |
if ($type eq "i" || ($type eq "s" && $base)) { |
28 |
push @cmd, ("-i", $base); |
29 |
} |
30 |
@@ -1346,7 +1359,11 @@ sub zfs_restore_part($$$$;$) { |
31 |
open(DUMP, "__ZFS__ send $dataset |"); |
32 |
} |
33 |
eval { |
34 |
- open(RECEIVER, "| ssh $ssh_config $host $command"); |
35 |
+ if ($host eq "localhost") { |
36 |
+ open(RECEIVER, "| $command"); |
37 |
+ } else { |
38 |
+ open(RECEIVER, "| ssh $ssh_config $host $command"); |
39 |
+ } |
40 |
my $buffer; |
41 |
while(my $len = sysread(DUMP, $buffer, $BLOCKSIZE)) { |
42 |
if(syswrite(RECEIVER, $buffer, $len) != $len) { |
43 |
@@ -1573,7 +1590,12 @@ sub plan_and_run($$) { |
44 |
# Get list of zfs filesystems from the agent |
45 |
open(SILENT, ">&", \*STDERR); |
46 |
close(STDERR); |
47 |
- my $rv = open(ZFSLIST, "ssh $ssh_config $host $agent -l |"); |
48 |
+ my $rv; |
49 |
+ if ($host eq "localhost") { |
50 |
+ $rv = open(ZFSLIST, "$agent -l |"); |
51 |
+ } else { |
52 |
+ $rv = open(ZFSLIST, "ssh $ssh_config $host $agent -l |"); |
53 |
+ } |
54 |
open(STDERR, ">&", \*SILENT); |
55 |
close(SILENT); |
56 |
next unless $rv; |