# Version __VERSION__, __RELEASEDATE__
#------------------------------------------------------------------------
+* Minor tweaks to disable utf8 on utf8-capable machines (eg: RH8+).
+ Added "no utf8" to all programs, and added binmode() to relevant
+ file handles.
+
+#------------------------------------------------------------------------
+# Version 2.0.0beta3, 1 Jun 2003
+#------------------------------------------------------------------------
+
* Several improvements to restore: cancel now reports the correct
message and cleans up correctly.
* Rsync with whitespace and wildcard excludes fixed by replacing
- argList with argList+ in config.pl.
+ argList with argList+ in config.pl plus a fix to Lib.pm for
+ shell escaping array arguments.
+
+* Fixed rsync restore for character and block special devices
+ (major and minor device numbers weren't correctly restored).
* Fixed typo in bin/BackupPC_restore (XferLOG -> RestoreLOG).
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use vars qw(%Status %Info $Hosts);
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use File::Find;
use File::Path;
$Errors++;
return;
}
+ binmode(FH);
while ( sysread(FH, $dataIn, $CompMaxWrite) > 0 ) {
$flush = 0;
$FileOrigSz += length($dataIn);
close(FH);
return;
}
+ binmode(OUT);
$copy = 1;
}
if ( $copy && $dataOut ne "" ) {
unlink("$file.__z");
return;
}
+ binmode(FH);
}
if ( $copy ) {
if ( !sysseek(OUT, 0, 0) ) {
$f->close();
return;
}
+ binmode(FH);
#print("comparing $file to $cfile\n");
while ( 1 ) {
$n = 1 + int(rand($CompMaxRead) + rand(100));
$f->close();
return;
}
+ binmode(FH);
while ( 1 ) {
$d0 = <FH>;
$d = $f->readLine();
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
use BackupPC::FileZIO;
close(WH);
last;
}
+ binmode(TAR);
if ( !$tarPid ) {
#
# This is the tar child. Close the write end of the pipe,
open(NEW_FILES, ">", "$TopDir/pc/$client/NewFileList")
|| die("can't open $TopDir/pc/$client/NewFileList");
$newFilesFH = *NEW_FILES;
+ binmode(NEW_FILES);
}
#
LOG => *LOG,
XferLOG => $XferLOG,
stat => \%stat,
- xferOK => $stat{xferOK},
+ xferOK => $stat{xferOK} || 0,
type => $type,
};
my $cmd = $bpc->cmdVarSubstitute($Conf{$type}, $vars);
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
use BackupPC::Attrib;
$CurrDumpDir = "$Dir/$Backups[$num]{num}";
$Compress = $Backups[$num]{compress};
if ( open(NEW, "<", "$Dir/NewFileList.$Backups[$num]{num}") ) {
+ binmode(NEW);
while ( <NEW> ) {
chomp;
next if ( !/(\w+) (\d+) (.*)/ );
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
use BackupPC::FileZIO;
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
use BackupPC::FileZIO;
$stat{hostError} = "Can't fork to run tar";
exit(RestoreCleanup($client));
}
+ binmode(TAR);
if ( !$tarPid ) {
#
# This is the tarCreate child. Clone STDERR to STDOUT,
return if ( !defined($Conf{$type}) );
my $vars = {
xfer => $xfer,
+ client => $client,
host => $host,
hostIP => $hostIP,
share => $RestoreReq{shareDest},
moreUsers => $Hosts->{$client}{moreUsers},
XferLOG => $RestoreLOG,
stat => \%stat,
- xferOK => $stat{xferOK},
+ xferOK => $stat{xferOK} || 0,
type => $type,
bkupSrcHost => $RestoreReq{hostSrc},
bkupSrcShare => $RestoreReq{shareSrc},
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
use BackupPC::FileZIO;
[\%UserEmailInfo],
[qw(*UserEmailInfo)]);
if ( open(HOST, ">", "$TopDir/log/UserEmailInfo.pl") ) {
+ binmode(HOST);
print(HOST $dumpStr);
close(HOST);
}
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
use BackupPC::FileZIO;
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use File::Path;
use Getopt::Std;
#
# Write out all the requested files/directories
#
+binmode(STDOUT);
my $fh = *STDOUT;
foreach my $dir ( @ARGV ) {
archiveWrite($fh, $dir);
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
use BackupPC::Attrib qw(:all);
mkpath("$OutDir/$ShareName", 0, 0777);
open(NEW_FILES, ">>", "$TopDir/pc/$host/NewFileList")
|| die("can't open $TopDir/pc/$host/NewFileList");
+binmode(NEW_FILES);
binmode(STDIN);
1 while ( TarReadFile(*STDIN) );
1 while ( sysread(STDIN, my $discard, 1024) );
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use Compress::Zlib;
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use lib "/usr/local/BackupPC/lib";
use Archive::Zip qw(:ERROR_CODES);
use File::Path;
$fh->fdopen(fileno(STDOUT),"w");
my $zipfh = Archive::Zip->new();
+binmode(STDOUT);
foreach my $dir ( @ARGV ) {
archiveWrite($zipfh, $dir);
}
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
use strict;
+no utf8;
use CGI;
use lib "/usr/local/BackupPC/lib";
use BackupPC::Lib;
} elsif ( $type eq "docs" ) {
$file = "$BinDir/../doc/BackupPC.html";
if ( open(LOG, $file) ) {
+ binmode(LOG);
Header($Lang->{BackupPC__Documentation});
print while ( <LOG> );
close(LOG);
[qw(*RestoreReq)]);
$dump->Indent(1);
if ( open(REQ, ">$TopDir/pc/$hostDest/$reqFileName") ) {
+ binmode(REQ);
print(REQ $dump->Dump);
close(REQ);
} else {
$Conf{DfPath} = '/bin/df';
#
-# Command to run df. Several variables are substituted at run-time:
+# Command to run df. The following variables are substituted at run-time:
#
# $dfPath path to df ($Conf{DfPath})
# $topDir top-level BackupPC data directory
# - 'tar': backup and restore via tar, tar over ssh, rsh or nfs.
# Good choice for linux/unix.
#
-# A future version should support 'rsync' as a transport method for
-# more efficient backup of linux/unix machines (and perhaps WinXX??).
-#
$Conf{XferMethod} = 'smb';
#
# Commands to run smbclient for a full dump, incremental dump or a restore.
# This setting only matters if $Conf{XferMethod} = 'smb'.
#
-# Several variables are substituted at run-time:
+# The following variables are substituted at run-time:
#
# $smbClientPath same as $Conf{SmbClientPath}
# $host host to backup/restore
# are sufficient to read all the files you want to backup. Also, you
# will probably want to add "/proc" to $Conf{BackupFilesExclude}.
#
-# Several variables are substituted at run-time. The following variables
-# are substituted at run-time:
+# The following variables are substituted at run-time:
#
# $host host name
# $hostIP host's IP address
#
# NmbLookup command. Given an IP address, does an nmblookup on that
-# IP address. Several variables are substituted at run-time:
+# IP address. The following variables are substituted at run-time:
#
# $nmbLookupPath path to nmblookup ($Conf{NmbLookupPath})
# $host IP address
$Conf{PingPath} = '/bin/ping';
#
-# Ping command. Several variables are substituted at run-time:
+# Ping command. The following variables are substituted at run-time:
#
# $pingPath path to ping ($Conf{PingPath})
# $host host name
#
# $Conf{DumpPreUserCmd} = '$sshPath -l root $host /usr/bin/dumpMysql';
#
-# Various variable substitutions are available; see BackupPC_dump
-# or BackupPC_restore for the details.
+# The following variable substitutions are made at run time for
+# $Conf{DumpPreUserCmd} and $Conf{DumpPostUserCmd}:
+#
+# $type type of dump (incr or full)
+# $xferOK 1 if the dump succeeded, 0 if it didn't
+# $client client name being backed up
+# $host host name (could be different from client name if
+# $Conf{ClientNameAlias} is set)
+# $hostIP IP address of host
+# $user user name from the hosts file
+# $moreUsers list of additional users from the hosts file
+# $share the first share name
+# $shares list of all the share names
+# $XferMethod value of $Conf{XferMethod} (eg: tar, rsync, smb)
+# $sshPath value of $Conf{SshPath},
+#
+# The following variable substitutions are made at run time for
+# $Conf{RestorePreUserCmd} and $Conf{RestorePostUserCmd}:
+#
+# $client client name being backed up
+# $xferOK 1 if the restore succeeded, 0 if it didn't
+# $host host name (could be different from client name if
+# $Conf{ClientNameAlias} is set)
+# $hostIP IP address of host
+# $user user name from the hosts file
+# $moreUsers list of additional users from the hosts file
+# $share the first share name
+# $XferMethod value of $Conf{XferMethod} (eg: tar, rsync, smb)
+# $sshPath value of $Conf{SshPath},
+# $type set to "restore"
+# $bkupSrcHost host name of the restore source
+# $bkupSrcShare share name of the restore source
+# $bkupSrcNum backup number of the restore source
+# $pathHdrSrc common starting path of restore source
+# $pathHdrDest common starting path of destination
+# $fileList list of files being restored
#
$Conf{DumpPreUserCmd} = undef;
$Conf{DumpPostUserCmd} = undef;
#========================================================================
use strict;
+no utf8;
use vars qw(%Conf %OrigConf);
use lib "./lib";
unless chown($uid, $gid, $confCopy);
die("can't chmod $mode $confCopy\n") unless chmod($mode, $confCopy);
}
-open(OUT, ">$dest") || die("can't open $dest for writing\n");
+open(OUT, ">", $dest) || die("can't open $dest for writing\n");
+binmode(OUT);
my $blockComment;
foreach my $var ( @$newConf ) {
if ( length($blockComment)
if ( $binary ) {
die("can't copy($prog, $dest)\n") unless copy($prog, $dest);
} else {
- open(PROG, $prog) || die("can't open $prog for reading\n");
- open(OUT, ">$dest") || die("can't open $dest for writing\n");
+ open(PROG, $prog) || die("can't open $prog for reading\n");
+ open(OUT, ">", $dest) || die("can't open $dest for writing\n");
+ binmode(PROG);
+ binmode(OUT);
while ( <PROG> ) {
s/__INSTALLDIR__/$Conf{InstallDir}/g;
s/__TOPDIR__/$Conf{TopDir}/g;
{
my($file) = @_;
open(C, $file) || die("can't open $file");
+ binmode(C);
my($out, @conf, $var);
my $comment = 1;
my $allVars = {};
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
} else {
open(FH, "<", $fileName) || return;
}
+ binmode(FH);
$fh = *FH;
}
$compLevel = 0 if ( !$CompZlibOK );
my $fh = BackupPC::FileZIO->open($destFileZ, 1, $compress);
my $data;
if ( defined($fh) && open(LOG, "<", $srcFile) ) {
+ binmode(LOG);
while ( sysread(LOG, $data, 65536) > 0 ) {
$fh->write(\$data);
}
<li> Klicken Sie auf eine Datei um diese per download wiederherzustellen.
</ul>
-\${h2("Contents of \${EscHTML(\$dirDisplay)}")}
+\${h2("Inhalt von \${EscHTML(\$dirDisplay)}")}
<form name="form1" method="post" action="\$MyURL">
<input type="hidden" name="num" value="\$num">
<input type="hidden" name="host" value="\$host">
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
TopDir => $topDir || '/data/BackupPC',
BinDir => $installDir || '/usr/local/BackupPC',
LibDir => $installDir || '/usr/local/BackupPC',
- Version => '2.0.0beta3',
+ Version => '2.0.0',
BackupFields => [qw(
num type startTime endTime
nFiles size nFilesExist sizeExist nFilesNew sizeNew
flock(LOCK, LOCK_EX) if open(LOCK, "$bpc->{TopDir}/pc/$host/LOCK");
if ( open(BK_INFO, "$bpc->{TopDir}/pc/$host/backups") ) {
+ binmode(BK_INFO);
while ( <BK_INFO> ) {
s/[\n\r]+//;
next if ( !/^(\d+\t(incr|full)[\d\t]*$)/ );
"$bpc->{TopDir}/pc/$host/backups.old")
if ( -f "$bpc->{TopDir}/pc/$host/backups" );
if ( open(BK_INFO, ">$bpc->{TopDir}/pc/$host/backups") ) {
+ binmode(BK_INFO);
for ( $i = 0 ; $i < @Backups ; $i++ ) {
my %b = %{$Backups[$i]};
printf(BK_INFO "%s\n", join("\t", @b{@{$bpc->{BackupFields}}}));
flock(LOCK, LOCK_EX) if open(LOCK, "$bpc->{TopDir}/pc/$host/LOCK");
if ( open(RESTORE_INFO, "$bpc->{TopDir}/pc/$host/restores") ) {
+ binmode(RESTORE_INFO);
while ( <RESTORE_INFO> ) {
s/[\n\r]+//;
next if ( !/^(\d+.*)/ );
"$bpc->{TopDir}/pc/$host/restores.old")
if ( -f "$bpc->{TopDir}/pc/$host/restores" );
if ( open(RESTORE_INFO, ">$bpc->{TopDir}/pc/$host/restores") ) {
+ binmode(RESTORE_INFO);
for ( $i = 0 ; $i < @Restores ; $i++ ) {
my %b = %{$Restores[$i]};
printf(RESTORE_INFO "%s\n",
"Can't open $bpc->{TopDir}/conf/hosts\n");
return {};
}
+ binmode(HOST_INFO);
while ( <HOST_INFO> ) {
s/[\n\r]+//;
s/#.*//;
$name = $1 if ( $name =~ /(.*)/ );
return ("", 0) if ( $fileSize == 0 );
return ("", -1) if ( !open(N, $name) );
+ binmode(N);
$md5->reset();
$md5->add($fileSize);
if ( $fileSize > 262144 ) {
return $err if ( !defined($stdoutCB) );
return;
}
+ binmode(CHILD);
if ( !$pid ) {
#
# This is the child
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
if ( open(F, "+>", "$fio->{outDirSh}RStmp") ) {
my $data;
my $byteCnt = 0;
+ binmode(F);
while ( $fh->read(\$data, 1024 * 1024) > 0 ) {
if ( syswrite(F, $data) != length($data) ) {
$fio->log(sprintf("Can't write len=%d to %s",
$fh->close;
} else {
if ( open(F, "<", $attr->{fullPath}) ) {
+ binmode(F);
$fio->{rxInFd} = *F;
$fio->{rxInName} = $attr->{fullPath};
} else {
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.0.0beta3, released 1 Jun 2003.
+# Version 2.0.0, released 14 Jun 2003.
#
# See http://backuppc.sourceforge.net.
#
umask(0022);
-my $Version = "2.0.0beta3";
-my $ReleaseDate = "1 Jun 2003";
+my $Version = "2.0.0";
+my $ReleaseDate = "14 Jun 2003";
my $DistDir = "dist/BackupPC-$Version";
my @PerlSrc = qw(
} else {
open(FILE, $file) || die("can't open $file for reading\n");
open(OUT, ">$dest") || die("can't open $dest for writing\n");
+ binmode(FILE);
+ binmode(OUT);
while ( <FILE> ) {
s/^# *Version \d+\.\d+[\.\w]*, released \d+ \w+ \d{4}\.?/# Version __VERSION__, released __RELEASEDATE__./;
s/__VERSION__/$Version/g;
sub config2pod
{
open(C, "conf/config.pl") || die("can't open conf/config.pl");
+ binmode(C);
my($str, $out, $getHdr, @conf);
my $first = 1;
while ( <C> ) {
my $errors;
open(F, $file) || die("can't open $file\n");
+ binmode(F);
if ( $check ) {
while ( <F> ) {
s/\$(self|bpc)->{Conf}{([^}\$]+)}/if ( !defined($vars->{$2}) ) {
foreach my $file ( qw(cgi-bin/BackupPC_Admin bin/BackupPC_sendEmail) ) {
open(F, $file) || die("can't open $file");
+ binmode(F);
while ( <F> ) {
s/\$Lang->{([^}]*)}/$vars->{$1} = 1;/eg;
}
foreach my $f ( <lib/BackupPC/Lang/*.pm> ) {
my $done = {};
open(F, $f) || die("can't open $f\n");
+ binmode(F);
while ( <F> ) {
s/#.*//g;
s/\$Lang{([^}]*)}/