X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=bin%2FBackupPC_zipCreate;h=88a57428545983a072f47d8d029986c792948f59;hb=refs%2Ftags%2Fv2_1_2;hp=cb56ac28f2e907dd26a2a6882b2da0f53683241f;hpb=7dee89bfce659051d486cc66515bb7f22bbc4f09;p=BackupPC.git diff --git a/bin/BackupPC_zipCreate b/bin/BackupPC_zipCreate index cb56ac2..88a5742 100755 --- a/bin/BackupPC_zipCreate +++ b/bin/BackupPC_zipCreate @@ -1,4 +1,4 @@ -#!/bin/perl -T +#!/bin/perl #============================================================= -*-perl-*- # # BackupPC_zipCreate: create a zip archive of an existing dump @@ -33,7 +33,7 @@ # Based on Backup_tarCreate by Craig Barratt # # COPYRIGHT -# Copyright (C) 2002 Craig Barratt and Guillaume Filion +# Copyright (C) 2002-2003 Craig Barratt and Guillaume Filion # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -51,14 +51,15 @@ # #======================================================================== # -# Version 2.0.0beta1, released 30 Mar 2003. +# Version 2.1.2, released 5 Sep 2005. # # See http://backuppc.sourceforge.net. # #======================================================================== use strict; -use lib "/usr/local/BackupPC/lib"; +no utf8; +use lib "/usr/local/BackupPC2.1.0/lib"; use Archive::Zip qw(:ERROR_CODES); use File::Path; use Getopt::Std; @@ -132,6 +133,7 @@ my $fh = new IO::Handle; $fh->fdopen(fileno(STDOUT),"w"); my $zipfh = Archive::Zip->new(); +binmode(STDOUT); foreach my $dir ( @ARGV ) { archiveWrite($zipfh, $dir); } @@ -269,8 +271,14 @@ sub ZipWriteFile } return if ( !$zipmember ); - # Set the attributes and permissions - $zipmember->setLastModFileDateTimeFromUnix($hdr->{mtime}); + # + # Set the attributes and permissions. The standard zip file + # header cannot handle dates prior to 1/1/1980, or 315561600 + # unix seconds, so we round up the mtime. + # + my $mtime = $hdr->{mtime}; + $mtime = 315561600 if ( $mtime < 315561600 ); + $zipmember->setLastModFileDateTimeFromUnix($mtime); $zipmember->unixFileAttributes($hdr->{mode}); # Zip files don't accept uid and gid, so we put them in the comment field. $zipmember->fileComment("uid=".$hdr->{uid}." gid=".$hdr->{gid})