Last active
August 1, 2016 01:39
-
-
Save sergey-dryabzhinsky/8ee9401d58a59374056dd1d751a1efd2 to your computer and use it in GitHub Desktop.
Fixed ayufan proxmox differential backup for QemuServer part of pve-manager-3.4-14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/QemuServer.pm b/QemuServer.pm | |
index 970edb5..9e7b281 100644 | |
--- a/QemuServer.pm | |
+++ b/QemuServer.pm | |
@@ -4749,10 +4749,20 @@ sub tar_archive_read_firstfile { | |
die "ERROR: file '$archive' does not exist\n" if ! -f $archive; | |
+ my $cmd = undef; | |
+ | |
+ if ($archive =~ m!([^/]*vzdump-([a-z]*)-(\d*)-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|(tar(\.(gz|lzo))?)))--differential-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.vcdiff(\.(gz|lzo))?$!) { | |
+ my $fullbackup = $archive; | |
+ $fullbackup =~ s!([^/]*vzdump-([a-z]+)-(\d+)-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|(tar(\.(gz|lzo))?)))--differential-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.vcdiff(\.(gz|lzo))?!$1!; | |
+ $cmd = "pve-xdelta3 -q -d -c -R -s '$fullbackup' '$archive' |tar t|"; | |
+ } else { | |
+ $cmd = "tar tf '$archive'|"; | |
+ } | |
+ | |
# try to detect archive type first | |
- my $pid = open (my $fh, '-|', 'tar', 'tf', $archive) || | |
+ my $pid = open (TMP, $cmd) || | |
die "unable to open file '$archive'\n"; | |
- my $firstfile = <$fh>; | |
+ my $firstfile = <TMP>; | |
kill 15, $pid; | |
- close $fh; | |
+ close TMP; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment