diff options
author | Cy Schubert <cy@FreeBSD.org> | 2020-05-03 13:57:29 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2020-05-03 13:57:29 +0000 |
commit | 2ce3d2fd57f4f014ed4ee0c622cfe704d64e2257 (patch) | |
tree | a7c0ae4eabb24caa7ffa707e537698a59e547d99 /sysutils | |
parent | MFH: r533741 (diff) |
MFH: r533732 r533736 r533780
Unbreak, make fetchable again.
PR: 246132
Mostly by: Armin Gruner <ag-freebsd@muc.de>
Add compression program and output to localhost options
PR 246132
Mostly by: Armin Gruner <ag-freebsd@muc.de>
Fix typos.
PR: 246132
Submitted by: Armin Gruner <ailto:ag-freebsd@muc.de>
Approved by: portmgr (joneum)
Notes
Notes:
svn path=/branches/2020Q2/; revision=533784
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/zetaback/Makefile | 13 | ||||
-rw-r--r-- | sysutils/zetaback/distinfo | 5 | ||||
-rw-r--r-- | sysutils/zetaback/files/opt-compression.in | 66 | ||||
-rw-r--r-- | sysutils/zetaback/files/opt-localhost.in | 56 | ||||
-rw-r--r-- | sysutils/zetaback/files/patch-zetaback.in | 11 |
5 files changed, 146 insertions, 5 deletions
diff --git a/sysutils/zetaback/Makefile b/sysutils/zetaback/Makefile index 8364da31fb5a..ac76f63c2bcf 100644 --- a/sysutils/zetaback/Makefile +++ b/sysutils/zetaback/Makefile @@ -2,18 +2,25 @@ # $FreeBSD$ PORTNAME= zetaback -PORTVERSION= 1.0.7 +DISTVERSION= 1.0.7 CATEGORIES= sysutils -MASTER_SITES= http://mirrors.omniti.com/zetaback/ MAINTAINER= cy@FreeBSD.org COMMENT= Zetaback ZFS backup and recovery management system -BROKEN= unfetchable +USE_GITHUB= yes +GH_ACCOUNT= omniti-labs LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE +OPTIONS_DEFINE= LOCAL BETTER_COMPRESSION +LOCAL_DESC= Avoid ssh for localhost backup +BETTER_COMPRESSION_DESC= Allow different compressions for snapshots + +LOCAL_EXTRA_PATCHES= ${PATCHDIR}/opt-localhost.in +BETTER_COMPRESSION_EXTRA_PATCHES= ${PATCHDIR}/opt-compression.in + USES= autoreconf perl5 USE_PERL5= run GNU_CONFIGURE= yes diff --git a/sysutils/zetaback/distinfo b/sysutils/zetaback/distinfo index c67ac58119e3..7451b0ca1b54 100644 --- a/sysutils/zetaback/distinfo +++ b/sysutils/zetaback/distinfo @@ -1,2 +1,3 @@ -SHA256 (zetaback-1.0.7.tar.gz) = e4bad4bb4a0149d44e5ae6022519b2927e4c0b5a0da465d47b4e66d707270270 -SIZE (zetaback-1.0.7.tar.gz) = 49934 +TIMESTAMP = 1588467175 +SHA256 (omniti-labs-zetaback-1.0.7_GH0.tar.gz) = b10c6df2b27d823f5fc18e4c7c8460e8231a86d32d89f9c73a916a7b15f98888 +SIZE (omniti-labs-zetaback-1.0.7_GH0.tar.gz) = 25592 diff --git a/sysutils/zetaback/files/opt-compression.in b/sysutils/zetaback/files/opt-compression.in new file mode 100644 index 000000000000..476225e8cb32 --- /dev/null +++ b/sysutils/zetaback/files/opt-compression.in @@ -0,0 +1,66 @@ +--- zetaback.in.orig 2019-01-31 14:04:38.000000000 -0800 ++++ zetaback.in 2020-05-02 16:38:22.402137000 -0700 +@@ -434,11 +434,15 @@ + + This value defaults to (14 * 86400), or two weeks. + ++=item compressionprogram ++ ++Compress files using gzip, bzip2, or xz. Defaults to gzip. ++ + =item compressionlevel + +-Compress files using gzip at the specified compression level. 0 means no +-compression. Accepted values are 1-9. Defaults to 1 (fastest/minimal +-compression.) ++Compress files using gzip, bzip2, or xz at the specified compression level. ++0 means no compression. Accepted values are 1-9. Defaults to 1 ++(fastest/minimal compression.) + + =item ssh_config + +@@ -781,9 +785,18 @@ + + # compression is meaningless for dataset backups + if ($type ne "s") { ++ my $cp = config_get($host, 'compressionprogram'); ++ if ($cp ne "xz" && $cp ne "bzip2" && $cp ne "gzip" && $cp ne "") { ++ die "zfs_full_backup: unsupported compression program specified\n"; ++ } elsif ($cp eq "") { ++ $cp = "gzip"; ++ my $cl = 1; ++ } else { ++ my $cl = 1; ++ } + my $cl = config_get($host, 'compressionlevel'); + if ($cl >= 1 && $cl <= 9) { +- open(LBACKUP, "|gzip -$cl >$store/.$dumpname") || ++ open(LBACKUP, "|$cp -$cl >$store/.$dumpname") || + die "zfs_do_backup $host:$fs $type: cannot create dump\n"; + } else { + open(LBACKUP, ">$store/.$dumpname") || +@@ -1319,16 +1332,22 @@ + else { + $command = "__ZFS__ recv $fs"; + } ++ my $cp = config_get($host, 'compressionprogram'); ++ if ($cp ne "xz" && $cp ne "bzip2" && $cp ne "gzip" && $cp ne "") { ++ die "zfs_full_backup: unsupported compression program specified\n"; ++ } elsif ($cp eq "") { ++ $cp = "gzip"; ++ } + if ($file) { + print " => piping $file to $command\n" if($DEBUG); +- print "gzip -dfc $file | ssh $ssh_config $host $command\n" if ($DEBUG && $NEUTERED); ++ print "$cp -dfc $file | ssh $ssh_config $host $command\n" if ($DEBUG); + } elsif ($dataset) { + print " => piping $dataset to $command using zfs send\n" if ($DEBUG); + print "zfs send $dataset | ssh $ssh_config $host $command\n" if ($DEBUG && $NEUTERED); + } + unless($NEUTERED) { + if ($file) { +- open(DUMP, "gzip -dfc $file |"); ++ open(DUMP, "$cp -dfc $file |"); + } elsif ($dataset) { + open(DUMP, "__ZFS__ send $dataset |"); + } diff --git a/sysutils/zetaback/files/opt-localhost.in b/sysutils/zetaback/files/opt-localhost.in new file mode 100644 index 000000000000..6035e9cf1eb7 --- /dev/null +++ b/sysutils/zetaback/files/opt-localhost.in @@ -0,0 +1,56 @@ +--- zetaback.in.orig 2020-05-02 21:18:03 UTC ++++ zetaback.in +@@ -769,7 +769,11 @@ sub zfs_remove_snap($$$) { + } + return unless($snap); + print "Dropping $snap on $fs\n" if($DEBUG); +- `ssh $ssh_config $host $agent -z $fs -d $snap`; ++ if ($host eq "localhost") { ++ `$agent -z $fs -d $snap`; ++ } else { ++ `ssh $ssh_config $host $agent -z $fs -d $snap`; ++ } + } + + # Lots of args.. internally called. +@@ -832,7 +836,12 @@ sub zfs_do_backup($$$$$$;$) { + die "Child exit value: $ev" if ($ev); + } + else { +- my @cmd = ('ssh', split(/ /, $ssh_config), $host, $agent, '-z', $fs); ++ my @cmd; ++ if ($host eq "localhost") { ++ @cmd = ($agent, '-z', $fs); ++ } else { ++ @cmd = ('ssh', split(/ /, $ssh_config), $host, $agent, '-z', $fs); ++ } + if ($type eq "i" || ($type eq "s" && $base)) { + push @cmd, ("-i", $base); + } +@@ -1346,7 +1359,11 @@ sub zfs_restore_part($$$$;$) { + open(DUMP, "__ZFS__ send $dataset |"); + } + eval { +- open(RECEIVER, "| ssh $ssh_config $host $command"); ++ if ($host eq "localhost") { ++ open(RECEIVER, "| $command"); ++ } else { ++ open(RECEIVER, "| ssh $ssh_config $host $command"); ++ } + my $buffer; + while(my $len = sysread(DUMP, $buffer, $BLOCKSIZE)) { + if(syswrite(RECEIVER, $buffer, $len) != $len) { +@@ -1573,7 +1590,12 @@ sub plan_and_run($$) { + # Get list of zfs filesystems from the agent + open(SILENT, ">&", \*STDERR); + close(STDERR); +- my $rv = open(ZFSLIST, "ssh $ssh_config $host $agent -l |"); ++ my $rv; ++ if ($host eq "localhost") { ++ $rv = open(ZFSLIST, "$agent -l |"); ++ } else { ++ $rv = open(ZFSLIST, "ssh $ssh_config $host $agent -l |"); ++ } + open(STDERR, ">&", \*SILENT); + close(SILENT); + next unless $rv; diff --git a/sysutils/zetaback/files/patch-zetaback.in b/sysutils/zetaback/files/patch-zetaback.in new file mode 100644 index 000000000000..9ce8694871b8 --- /dev/null +++ b/sysutils/zetaback/files/patch-zetaback.in @@ -0,0 +1,11 @@ +--- zetaback.in.orig 2019-01-31 22:04:38 UTC ++++ zetaback.in +@@ -1585,7 +1585,7 @@ sub plan_and_run($$) { + + foreach my $diskline (@disklist) { + chomp($diskline); +- next unless($diskline =~ /^(\S+) \[([^\]]*)\](?: {([^}]*)})?/); ++ next unless($diskline =~ /^(\S+) \[([^\]]*)\](?: \{([^}]*)\})?/); + my $diskname = $1; + my %snaps; + map { $snaps{$_} = 1 } (split(/,/, $2)); |