cvs -z3 -d:pserver:anonymous@cvs.backuppc.sourceforge.net:/cvsroot/backuppc co -r v1_5_0 BackupPC
-Building an installable release from the source:
------------------------------------------------
+Building an installable release from the CVS source:
+---------------------------------------------------
* Edit makeDist and set the version number and release date
all the library paths etc back into the symbolic form (eg: __INSTALLDIR__)
so that configure.pl will do the right thing.
+ Often the language files are not up to date, and makeDist exits after
+ complaining about the lang files being inconsistent. Use the -l option
+ to turn off that checking.
+
* You should now have a sub-directory dist/BackupPC-version containing
- the release and a tar ball dist/BackupPC-version.tar.gz. The tar
- ball can be copied, extracted and installed like any BackupPC release.
+ the release and a tar ball dist/BackupPC-VERSION.tar.gz. The tar
+ ball can be copied, extracted and installed using configure.pl
+ like any BackupPC release.
# DESCRIPTION
#
# BackupPC reads the configuration and status information from
-# $TopDir/conf. It then runs and manages all the backup activity.
+# $ConfDir/conf. It then runs and manages all the backup activity.
#
# As specified by $Conf{WakeupSchedule}, BackupPC wakes up periodically
# to queue backups on all the PCs. This is a four step process:
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
my $TopDir = $bpc->TopDir();
my $BinDir = $bpc->BinDir();
+my $LogDir = $bpc->LogDir();
my %Conf = $bpc->Conf();
#
#
# Read old status
#
-if ( -f "$TopDir/log/status.pl" && !(my $ret = do "$TopDir/log/status.pl") ) {
- die "couldn't parse $TopDir/log/status.pl: $@" if $@;
- die "couldn't do $TopDir/log/status.pl: $!" unless defined $ret;
- die "couldn't run $TopDir/log/status.pl";
+if ( -f "$LogDir/status.pl" && !(my $ret = do "$LogDir/status.pl") ) {
+ die "couldn't parse $LogDir/status.pl: $@" if $@;
+ die "couldn't do $LogDir/status.pl: $!" unless defined $ret;
+ die "couldn't run $LogDir/status.pl";
}
#
# Write out our initial status and save our PID
#
StatusWrite();
- if ( open(PID, ">", "$TopDir/log/BackupPC.pid") ) {
+ if ( open(PID, ">", "$LogDir/BackupPC.pid") ) {
print(PID $$);
close(PID);
}
$Info{DUDailySkipHostCntPrev} = $Info{DUDailySkipHostCnt};
$Info{DUDailySkipHostCnt} = 0;
my $lastLog = $Conf{MaxOldLogFiles} - 1;
- if ( -f "$TopDir/log/LOG.$lastLog" ) {
+ if ( -f "$LogDir/LOG.$lastLog" ) {
print(LOG $bpc->timeStamp,
- "Removing $TopDir/log/LOG.$lastLog\n");
- unlink("$TopDir/log/LOG.$lastLog");
+ "Removing $LogDir/LOG.$lastLog\n");
+ unlink("$LogDir/LOG.$lastLog");
}
- if ( -f "$TopDir/log/LOG.$lastLog.z" ) {
+ if ( -f "$LogDir/LOG.$lastLog.z" ) {
print(LOG $bpc->timeStamp,
- "Removing $TopDir/log/LOG.$lastLog.z\n");
- unlink("$TopDir/log/LOG.$lastLog.z");
+ "Removing $LogDir/LOG.$lastLog.z\n");
+ unlink("$LogDir/LOG.$lastLog.z");
}
print(LOG $bpc->timeStamp, "Aging LOG files, LOG -> LOG.0 -> "
. "LOG.1 -> ... -> LOG.$lastLog\n");
close(LOG);
for ( my $i = $lastLog - 1 ; $i >= 0 ; $i-- ) {
my $j = $i + 1;
- rename("$TopDir/log/LOG.$i", "$TopDir/log/LOG.$j")
- if ( -f "$TopDir/log/LOG.$i" );
- rename("$TopDir/log/LOG.$i.z", "$TopDir/log/LOG.$j.z")
- if ( -f "$TopDir/log/LOG.$i.z" );
+ rename("$LogDir/LOG.$i", "$LogDir/LOG.$j")
+ if ( -f "$LogDir/LOG.$i" );
+ rename("$LogDir/LOG.$i.z", "$LogDir/LOG.$j.z")
+ if ( -f "$LogDir/LOG.$i.z" );
}
#
# Compress the log file LOG -> LOG.0.z (if enabled).
# Otherwise, just rename LOG -> LOG.0.
#
- BackupPC::FileZIO->compressCopy("$TopDir/log/LOG",
- "$TopDir/log/LOG.0.z",
- "$TopDir/log/LOG.0",
+ BackupPC::FileZIO->compressCopy("$LogDir/LOG",
+ "$LogDir/LOG.0.z",
+ "$LogDir/LOG.0",
$Conf{CompressLevel}, 1);
LogFileOpen();
#
###########################################################################
#
-# Write the current status to $TopDir/log/status.pl
+# Write the current status to $LogDir/status.pl
#
sub StatusWrite
{
[ \%Info, \%Status],
[qw(*Info *Status)]);
$dump->Indent(1);
- if ( open(STATUS, ">", "$TopDir/log/status.pl") ) {
+ if ( open(STATUS, ">", "$LogDir/status.pl") ) {
print(STATUS $dump->Dump);
close(STATUS);
}
close(LOG);
LogFileOpen();
print(LOG "Fatal error: unhandled signal $SigName\n");
- unlink("$TopDir/log/BackupPC.pid");
+ unlink("$LogDir/BackupPC.pid");
confess("Got new signal $SigName... quitting\n");
} else {
$SigName = shift;
#
sub LogFileOpen
{
- mkpath("$TopDir/log", 0, 0777) if ( !-d "$TopDir/log" );
- open(LOG, ">>$TopDir/log/LOG")
- || die("Can't create LOG file $TopDir/log/LOG");
+ mkpath($LogDir, 0, 0777) if ( !-d $LogDir );
+ open(LOG, ">>$LogDir/LOG")
+ || die("Can't create LOG file $LogDir/LOG");
close(STDOUT);
close(STDERR);
open(STDOUT, ">&LOG");
print(LOG $bpc->timeStamp, "unix socket() failed: $!\n");
exit(1);
}
- my $sockFile = "$TopDir/log/BackupPC.sock";
+ my $sockFile = "$LogDir/BackupPC.sock";
unlink($sockFile);
if ( !bind(SERVER_UNIX, sockaddr_un($sockFile)) ) {
print(LOG $bpc->timeStamp, "unix bind() failed: $!\n");
}
delete($Info{pid});
StatusWrite();
- unlink("$TopDir/log/BackupPC.pid");
+ unlink("$LogDir/BackupPC.pid");
exit(1);
}
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
}
my $attrib = BackupPC::Attrib->new({ compress => $Conf{CompressLevel} });
-if ( !$attrib->read(".", $ARGV[0]) ) {
+
+my($dir, $file);
+
+if ( $ARGV[0] =~ m{(.+)/(.+)} ) {
+ $dir = $1;
+ $file = $2;
+} else {
+ $dir = $ARGV[0];
+}
+
+if ( !$attrib->read($dir, $file) ) {
print STDERR "Cannot read attrib file $ARGV[0]\n";
exit(1);
}
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
$bpc->ChildInit();
my $TopDir = $bpc->TopDir();
+my $LogDir = $bpc->LogDir();
my $BinDir = $bpc->BinDir();
my %Conf = $bpc->Conf();
my $PoolDir = "$TopDir/pool";
if ( !defined($host) ) {
for ( my $i = 0 ; ; $i++ ) {
- last if ( !-f "$TopDir/log/LOG.$i" );
- push(@Files, "$TopDir/log/LOG.$i");
+ last if ( !-f "$LogDir/LOG.$i" );
+ push(@Files, "$LogDir/LOG.$i");
}
} else {
@Backups = $bpc->BackupInfoRead($host);
# full or incremental backup needs to be run. If no backup is
# scheduled, or a ping to $client fails, then BackupPC_dump quits.
#
-# The backup is done using the selected XferMethod (smb, tar, rsync etc),
-# extracting the dump into $TopDir/pc/$client/new. The xfer output is
-# put into $TopDir/pc/$client/XferLOG.
+# The backup is done using the selected XferMethod (smb, tar, rsync,
+# backuppcd etc), extracting the dump into $TopDir/pc/$client/new.
+# The xfer output is put into $TopDir/pc/$client/XferLOG.
#
# If the dump succeeds (based on parsing the output of the XferMethod):
# - $TopDir/pc/$client/new is renamed to $TopDir/pc/$client/nnn, where
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
use BackupPC::Xfer::Smb;
use BackupPC::Xfer::Tar;
use BackupPC::Xfer::Rsync;
+use BackupPC::Xfer::BackupPCd;
use Socket;
use File::Path;
use File::Find;
$ShareNames = $Conf{TarShareName};
} elsif ( $Conf{XferMethod} eq "rsync" || $Conf{XferMethod} eq "rsyncd" ) {
$ShareNames = $Conf{RsyncShareName};
+} elsif ( $Conf{XferMethod} eq "backuppcd" ) {
+ $ShareNames = $Conf{BackupPCdShareName};
} else {
$ShareNames = $Conf{SmbShareName};
}
UserCommandRun("DumpPostUserCmd") if ( $NeedPostCmd );
exit(1);
}
+ } elsif ( $Conf{XferMethod} eq "backuppcd" ) {
+ #
+ # Use backuppcd as the transport program.
+ #
+ if ( !defined($xfer = BackupPC::Xfer::BackupPCd->new($bpc)) ) {
+ my $errStr = BackupPC::Xfer::BackupPCd::errStr;
+ print(LOG $bpc->timeStamp, "dump failed: $errStr\n");
+ print("dump failed: $errStr\n");
+ UserCommandRun("DumpPostShareCmd", $shareName) if ( $NeedPostCmd );
+ UserCommandRun("DumpPostUserCmd") if ( $NeedPostCmd );
+ exit(1);
+ }
} else {
#
# Default is to use smbclient (smb) as the transport program.
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
use BackupPC::Xfer::Smb;
use BackupPC::Xfer::Tar;
use BackupPC::Xfer::Rsync;
+use BackupPC::Xfer::BackupPCd;
use Socket;
use File::Path;
$stat{hostError} = $errStr;
exit(RestoreCleanup($client));
}
+} elsif ( $Conf{XferMethod} eq "backuppcd" ) {
+ #
+ # Use backuppcd as the transport program.
+ #
+ if ( !defined($xfer = BackupPC::Xfer::BackupPCd->new($bpc)) ) {
+ my $errStr = BackupPC::Xfer::BackupPCd->errStr;
+ UserCommandRun("RestorePostUserCmd") if ( $NeedPostCmd );
+ $stat{hostError} = $errStr;
+ exit(RestoreCleanup($client));
+ }
} else {
#
# Default is to use smbclient (smb) as the transport program.
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
use Data::Dumper;
use Getopt::Std;
use DirHandle ();
-use vars qw($Lang $TopDir $BinDir %Conf);
+use vars qw($Lang $TopDir $BinDir $LogDir %Conf);
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
$TopDir = $bpc->TopDir();
+$LogDir = $bpc->LogDir();
$BinDir = $bpc->BinDir();
%Conf = $bpc->Conf();
$Lang = $bpc->Lang();
$bpc->ChildInit();
use vars qw(%UserEmailInfo);
-do "$TopDir/log/UserEmailInfo.pl";
+do "$LogDir/UserEmailInfo.pl";
my %opts;
if ( !getopts("t", \%opts) || @ARGV != 0 ) {
my $dumpStr = Data::Dumper->Dump(
[\%UserEmailInfo],
[qw(*UserEmailInfo)]);
- if ( open(HOST, ">", "$TopDir/log/UserEmailInfo.pl") ) {
+ if ( open(HOST, ">", "$LogDir/UserEmailInfo.pl") ) {
binmode(HOST);
print(HOST $dumpStr);
close(HOST);
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
from_to($name, $Conf{ClientCharset}, "utf8");
from_to($linkname, $Conf{ClientCharset}, "utf8");
}
- printf("File now $name (hex: %s)\n", unpack("H*", $name));
+ # printf("File now $name (hex: %s)\n", unpack("H*", $name));
$name =~ s{^\./+}{};
$name =~ s{/+\.?$}{};
}
$f->close();
my $md5 = Digest::MD5->new;
+ my $len = length($dataMD5);
+ $hdr->{realSize} = $len if ( $hdr->{type} != BPC_FTYPE_FILE );
if ( $hdr->{realSize} < 1048576
&& length($dataMD5) != $hdr->{realSize} ) {
- printf(STDERR "File $hdr->{fullPath} has bad size"
- . " (expect $hdr->{realSize}, got %d)\n",
- length($dataMD5));
+ print(STDERR "File $hdr->{fullPath} has bad size"
+ . " (expect $hdr->{realSize}, got $len)\n");
} else {
my $digest = $bpc->Buffer2MD5($md5, $hdr->{realSize},
\$dataMD5);
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
$Conf{XferLogLevel} = 1;
+#
+# Filename charset encoding on the client. BackupPC uses utf8
+# on the server for filename encoding. If this is empty, then
+# utf8 is assumed and client filenames will not be modified. If set
+# to a different encoding then filenames will be re-encoded in utf8.
+# A typical WinXX encoding for latin1/western europe is 'cp1252'.
+# Do "perldoc Encode::Supported" to see the list of possible charset
+# values, and also see http://czyborra.com/charsets/iso8859.html.
+#
+$Conf{ClientCharset} = '';
+
#
# Name of the host share that is backed up when using SMB. This can be a
# string or an array of strings if there are multiple shares per host.
#
];
+#
+# Share name to backup. For $Conf{XferMethod} = "backuppcd" this should
+# be a file system path, eg '/' or '/home'.
+#
+# This can also be a list of multiple file system paths or modules.
+# (Can it??)
+#
+# $Conf{BackupPCdShareName} = ['/', '/var', '/data', '/boot'];
+#
+$Conf{BackupPCdShareName} = '/';
+
+#
+# Path to backuppcd executable on the server
+#
+$Conf{BackupPCdPath} = '/usr/bin/backuppcd';
+
+#
+# Full command to run backuppcd on the server to backup a given
+# client machine. The following variables are substituted at
+# run-time (TODO: update this list)
+#
+# $host host name being backed up
+# $hostIP host's IP address
+# $shareName share name to backup (ie: top-level directory path)
+# $backuppcdPath same as $Conf{BackupPCdPath}
+# $sshPath same as $Conf{SshPath}
+#
+# This setting only matters if $Conf{XferMethod} = 'backuppcd'.
+#
+# Arguments to backupcpd are:
+#
+# - the host name to backup
+# - the share name to backup
+# - the directory where the pool is
+# - the directory where the last run was (NOT DONE YET)
+# - a boolean value indicating whether or not the pool is
+# compressed or not
+# - the directory where the new run should occur (currently it assumes ".")
+#
+$Conf{BackupPCdCmd} = '$bpcdPath $host $shareName $poolDir XXXX $poolCompress $topDir/pc/$client/new';
+
+#
+# Full command to run backuppcd on the server for restore to a
+# client machine. The following variables are substituted at
+# run-time (TODO: update this list)
+#
+# $host host name being backed up
+# $hostIP host's IP address
+# $shareName share name to backup (ie: top-level directory path)
+# $backuppcdPath same as $Conf{BackupPCdPath}
+# $sshPath same as $Conf{SshPath}
+#
+# This setting only matters if $Conf{XferMethod} = 'backuppcd'.
+#
+$Conf{BackupPCdRestoreCmd} = '$bpcdPath TODO';
+
+
#
# Archive Destination
#
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2001-2004 Craig Barratt
+# Copyright (C) 2001-2006 Craig Barratt
#
# 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
}
my %opts;
-$opts{fhs} = 1;
$opts{"set-perms"} = 1;
-$opts{"backuppc-user"} = "backuppc";
if ( !GetOptions(
\%opts,
"batch",
#
# InstallDir which includes subdirs bin, lib, doc
#
-# With FSH enabled (which is the default for new installations):
+# With FHS enabled (which is the default for new installations):
#
# /etc/BackupPC/config.pl main config file (was $TopDir/conf/config.pl)
# /etc/BackupPC/hosts hosts file (was $TopDir/conf/hosts)
#
my $ConfigPath = "";
while ( 1 ) {
- if ( $opts{fhs} && -f "/etc/BackupPC/config.pl" ) {
+ if ( -f "/etc/BackupPC/config.pl" ) {
$ConfigPath = "/etc/BackupPC/config.pl";
+ $opts{fhs} = 1 if ( !defined($opts{fhs}) );
} else {
$ConfigPath = prompt("--> Full path to existing main config.pl",
$ConfigPath,
"config-path");
}
last if ( $ConfigPath eq ""
- || ($ConfigPath =~ /^\// && -r $ConfigPath && -w $ConfigPath) );
+ || ($ConfigPath =~ /^\// && -f $ConfigPath && -w $ConfigPath) );
my $problem = "is not an absolute path";
$problem = "is not writable" if ( !-w $ConfigPath );
$problem = "is not readable" if ( !-r $ConfigPath );
exit(1);
}
}
+$opts{fhs} = 1 if ( !defined($opts{fhs}) && $ConfigPath eq "" );
+$opts{fhs} = 0 if ( !defined($opts{fhs}) );
my $bpc;
if ( $ConfigPath ne "" && -r $ConfigPath ) {
$Conf{ConfDir} ||= "/etc/BackupPC";
$Conf{InstallDir} ||= "/usr/local/BackupPC";
$Conf{LogDir} ||= "/var/log/BackupPC";
- $Conf{StatusDir} ||= "/var/lib/BackupPC";
}
#
#
foreach my $dir ( qw(bin doc
lib/BackupPC/CGI
+ lib/BackupPC/Config
lib/BackupPC/Lang
+ lib/BackupPC/Storage
lib/BackupPC/Xfer
lib/BackupPC/Zip
) ) {
"$Conf{TopDir}/trash",
"$Conf{ConfDir}",
"$Conf{LogDir}",
- "$Conf{StatusDir}",
) ) {
mkpath("$DestDir/$dir", 0, 0750) if ( !-d "$DestDir/$dir" );
if ( !-d "$DestDir/$dir"
printf("Installing library in $DestDir$Conf{InstallDir}/lib\n");
foreach my $lib ( qw(
- BackupPC/Lib.pm
BackupPC/FileZIO.pm
BackupPC/Attrib.pm
BackupPC/PoolWrite.pm
+ BackupPC/Lib.pm
+ BackupPC/Storage.pm
BackupPC/View.pm
- BackupPC/Xfer/Archive.pm
- BackupPC/Xfer/Tar.pm
- BackupPC/Xfer/Smb.pm
- BackupPC/Xfer/Rsync.pm
- BackupPC/Xfer/RsyncDigest.pm
- BackupPC/Xfer/RsyncFileIO.pm
- BackupPC/Zip/FileMember.pm
- BackupPC/Lang/en.pm
- BackupPC/Lang/fr.pm
- BackupPC/Lang/es.pm
- BackupPC/Lang/de.pm
- BackupPC/Lang/it.pm
- BackupPC/Lang/nl.pm
BackupPC/CGI/AdminOptions.pm
BackupPC/CGI/Archive.pm
BackupPC/CGI/ArchiveInfo.pm
BackupPC/CGI/StopServer.pm
BackupPC/CGI/Summary.pm
BackupPC/CGI/View.pm
+ BackupPC/Config/Meta.pm
+ BackupPC/Lang/en.pm
+ BackupPC/Lang/fr.pm
+ BackupPC/Lang/es.pm
+ BackupPC/Lang/de.pm
+ BackupPC/Lang/it.pm
+ BackupPC/Lang/nl.pm
+ BackupPC/Storage/Text.pm
+ BackupPC/Xfer/Archive.pm
+ BackupPC/Xfer/BackupPCd.pm
+ BackupPC/Xfer/Tar.pm
+ BackupPC/Xfer/Smb.pm
+ BackupPC/Xfer/Rsync.pm
+ BackupPC/Xfer/RsyncDigest.pm
+ BackupPC/Xfer/RsyncFileIO.pm
+ BackupPC/Zip/FileMember.pm
) ) {
InstallFile("lib/$lib", "$DestDir$Conf{InstallDir}/lib/$lib", 0444);
}
s/__LOGDIR__/$Conf{LogDir}/g;
s/__CONFDIR__/$Conf{ConfDir}/g;
s/__TOPDIR__/$Conf{TopDir}/g;
+ s/__USEFHS__/$opts{fhs}/g;
s/__BACKUPPCUSER__/$Conf{BackupPCUser}/g;
s/__CGIDIR__/$Conf{CgiDir}/g;
if ( $first && /^#.*bin\/perl/ ) {
=item B<--fhs>
Use locations specified by the Filesystem Hierarchy Standard
-for installing BackupPC. This is enabled by default. To
-use the pre-3.0 installation locations, specify --no-fhs.
+for installing BackupPC. This is enabled by default for new
+installatios. To use the pre-3.0 installation locations,
+specify --no-fhs.
=item B<--help|?>
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
$url0 = "&host=${EscURI($host)}";
$hdr = "for host $host";
} else {
- $root = "$TopDir/log/LOG";
+ $root = "$LogDir/LOG";
$url0 = "";
$hdr = "";
}
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS );
-use vars qw($Cgi %In $MyURL $User %Conf $TopDir $BinDir $bpc);
+use vars qw($Cgi %In $MyURL $User %Conf $TopDir $LogDir $BinDir $bpc);
use vars qw(%Status %Info %Jobs @BgQueue @UserQueue @CmdQueue
%QueueLen %StatusHost);
use vars qw($Hosts $HostsMTime $ConfigMTime $PrivAdmin);
NavLink
h1
h2
- $Cgi %In $MyURL $User %Conf $TopDir $BinDir $bpc
+ $Cgi %In $MyURL $User %Conf $TopDir $LogDir $BinDir $bpc
%Status %Info %Jobs @BgQueue @UserQueue @CmdQueue
%QueueLen %StatusHost
$Hosts $HostsMTime $ConfigMTime $PrivAdmin
ErrorExit($Lang->{BackupPC__Lib__new_failed__check_apache_error_log})
if ( !($bpc = BackupPC::Lib->new(undef, undef, undef, 1)) );
$TopDir = $bpc->TopDir();
+ $LogDir = $bpc->LogDir();
$BinDir = $bpc->BinDir();
%Conf = $bpc->Conf();
$Lang = $bpc->Lang();
sub ReadUserEmailInfo
{
- if ( (stat("$TopDir/log/UserEmailInfo.pl"))[9] != $UserEmailInfoMTime ) {
- do "$TopDir/log/UserEmailInfo.pl";
- $UserEmailInfoMTime = (stat("$TopDir/log/UserEmailInfo.pl"))[9];
+ if ( (stat("$LogDir/UserEmailInfo.pl"))[9] != $UserEmailInfoMTime ) {
+ do "$LogDir/UserEmailInfo.pl";
+ $UserEmailInfoMTime = (stat("$LogDir/UserEmailInfo.pl"))[9];
}
}
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
$file = "$TopDir/pc/$host/LOG$ext";
$linkHosts = 1;
} else {
- $file = "$TopDir/log/LOG$ext";
+ $file = "$LogDir/LOG$ext";
$linkHosts = 1;
}
if ( $type ne "docs" && !$Privileged ) {
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.1, released 13 Mar 2005.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
# Whether to use filesystem hierarchy standard for file layout.
# If set, text config files are below /etc/BackupPC.
#
- my $useFSH = 0;
+ my $useFHS = 0;
my $paths;
+ #
+ # Set defaults for $topDir and $installDir.
+ #
+ $topDir = '/tera0/backup/BackupPC' if ( $topDir eq "" );
+ $installDir = '/usr/local/BackupPC' if ( $installDir eq "" );
+
#
# Pick some initial defaults. For FHS the only critical
# path is the ConfDir, since we get everything else out
# of the main config file.
#
- if ( $useFSH ) {
+ if ( $useFHS ) {
$paths = {
- useFSH => $useFSH,
- TopDir => $topDir || '/data/BackupPC',
- BinDir => $installDir ? "$installDir/bin" : '/usr/local/BackupPC/bin',
- LibDir => $installDir ? "$installDir/lib" : '/usr/local/BackupPC/lib',
- ConfDir => $confDir || '/etc/BackupPC',
- LogDir => $topDir ? "$topDir/log" : '/var/log/BackupPC',
+ useFHS => $useFHS,
+ TopDir => $topDir,
+ BinDir => "$installDir/bin",
+ LibDir => "$installDir/lib",
+ ConfDir => $confDir eq "" ? '/etc/BackupPC' : $confDir,
+ LogDir => '/var/log/BackupPC',
};
} else {
$paths = {
- useFSH => $useFSH,
- TopDir => $topDir || '/data/BackupPC',
- BinDir => $installDir ? "$installDir/bin" : '/usr/local/BackupPC/bin',
- LibDir => $installDir ? "$installDir/lib" : '/usr/local/BackupPC/lib',
- ConfDir => $topDir ? "$topDir/conf" : '/data/BackupPC/conf',
- LogDir => $topDir ? "$topDir/log" : '/data/BackupPC/log',
+ useFHS => $useFHS,
+ TopDir => $topDir,
+ BinDir => "$installDir/bin",
+ LibDir => "$installDir/lib",
+ ConfDir => $confDir eq "" ? "$topDir/conf" : $confDir,
+ LogDir => "$topDir/log",
};
}
my $bpc = bless {
%$paths,
- Version => '2.1.0',
+ Version => '3.0.0alpha',
}, $class;
$bpc->{storage} = BackupPC::Storage->new($paths);
#
# First try the unix-domain socket
#
- my $sockFile = "$bpc->{TopDir}/log/BackupPC.sock";
+ my $sockFile = "$bpc->{LogDir}/BackupPC.sock";
socket(*FH, PF_UNIX, SOCK_STREAM, 0) || return "unix socket: $!";
if ( !connect(*FH, sockaddr_un($sockFile)) ) {
my $err = "unix connect: $!";
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
# Write the file
#
- return $s->TextFileWrite("$s->{TopDir}/pc/$host", "backups", $contents);
+ return $s->TextFileWrite("$s->{TopDir}/pc/$host/backups", $contents);
}
sub RestoreInfoRead
#
# Write the file
#
- return $s->TextFileWrite("$s->{TopDir}/pc/$host", "restores", $contents);
+ return $s->TextFileWrite("$s->{TopDir}/pc/$host/restores", $contents);
}
sub ArchiveInfoRead
#
# Write the file
#
- return $s->TextFileWrite("$s->{TopDir}/pc/$host", "archives", $contents);
+ return $s->TextFileWrite("$s->{TopDir}/pc/$host/archives", $contents);
}
#
#
sub TextFileWrite
{
- my($s, $dir, $file, $contents) = @_;
+ my($s, $file, $contents) = @_;
local(*FD, *LOCK);
my($fileOk);
+ (my $dir = $file) =~ s{(.+)/(.+)}{$1};
+
mkpath($dir, 0, 0775) if ( !-d $dir );
- if ( open(FD, ">", "$dir/$file.new") ) {
+ if ( open(FD, ">", "$file.new") ) {
binmode(FD);
print FD $contents;
close(FD);
#
# verify the file
#
- if ( open(FD, "<", "$dir/$file.new") ) {
+ if ( open(FD, "<", "$file.new") ) {
binmode(FD);
if ( join("", <FD>) ne $contents ) {
- return "TextFileWrite: Failed to verify $dir/$file.new";
+ return "TextFileWrite: Failed to verify $file.new";
} else {
$fileOk = 1;
}
$lock = 1;
flock(LOCK, LOCK_EX);
}
- if ( -s "$dir/$file" ) {
- unlink("$dir/$file.old") if ( -f "$dir/$file.old" );
- rename("$dir/$file", "$dir/$file.old") if ( -f "$dir/$file" );
+ if ( -s "$file" ) {
+ unlink("$file.old") if ( -f "$file.old" );
+ rename("$file", "$file.old") if ( -f "$file" );
} else {
- unlink("$dir/$file") if ( -f "$dir/$file" );
+ unlink("$file") if ( -f "$file" );
}
- rename("$dir/$file.new", "$dir/$file") if ( -f "$dir/$file.new" );
+ rename("$file.new", "$file") if ( -f "$file.new" );
close(LOCK) if ( $lock );
} else {
- return "TextFileWrite: Failed to write $dir/$file.new";
+ return "TextFileWrite: Failed to write $file.new";
}
return;
}
+sub ConfigPath
+{
+ my($s, $host) = @_;
+
+ return "$s->{ConfDir}/config.pl" if ( !defined($host) );
+ if ( $s->{useFHS} ) {
+ return "$s->{ConfDir}/host/$host.pl";
+ } else {
+ return "$s->{ConfDir}/$host.pl"
+ if ( $host ne "config" && -f "$s->{ConfDir}/$host.pl" );
+ return "$s->{TopDir}/pc/$host/config.pl";
+ }
+}
+
sub ConfigDataRead
{
my($s, $host) = @_;
# TODO: add lock
#
my $conf = {};
+ my $configPath = $s->ConfigPath($host);
- if ( defined($host) ) {
- push(@configs, "$s->{TopDir}/conf/$host.pl")
- if ( $host ne "config" && -f "$s->{TopDir}/conf/$host.pl" );
- push(@configs, "$s->{TopDir}/pc/$host/config.pl")
- if ( -f "$s->{TopDir}/pc/$host/config.pl" );
- } else {
- push(@configs, "$s->{TopDir}/conf/config.pl");
- }
+ push(@configs, $configPath) if ( -f $configPath );
foreach $config ( @configs ) {
%Conf = ();
if ( !defined($ret = do $config) && ($! || $@) ) {
{
my($s, $host, $newConf) = @_;
- my($confDir) = $host eq "" ? "$s->{TopDir}/conf"
- : "$s->{TopDir}/pc/$host";
+ my $configPath = $s->ConfigPath($host);
- my($err, $contents) = $s->ConfigFileMerge("$confDir/config.pl", $newConf);
+ my($err, $contents) = $s->ConfigFileMerge("$configPath", $newConf);
if ( defined($err) ) {
return $err;
} else {
#
# Write the file
#
- return $s->TextFileWrite($confDir, "config.pl", $contents);
+ return $s->TextFileWrite($configPath, $contents);
}
}
sub ConfigMTime
{
my($s) = @_;
- return (stat("$s->{TopDir}/conf/config.pl"))[9];
+ return (stat($s->ConfigPath()))[9];
}
#
-# Returns information from the host file in $s->{TopDir}/conf/hosts.
+# Returns information from the host file in $s->{ConfDir}/hosts.
# With no argument a ref to a hash of hosts is returned. Each
# hash contains fields as specified in the hosts file. With an
# argument a ref to a single hash is returned with information
my(%hosts, @hdr, @fld);
local(*HOST_INFO, *LOCK);
- flock(LOCK, LOCK_EX) if open(LOCK, "$s->{TopDir}/pc/$host/LOCK");
- if ( !open(HOST_INFO, "$s->{TopDir}/conf/hosts") ) {
- print(STDERR "Can't open $s->{TopDir}/conf/hosts\n");
+ flock(LOCK, LOCK_EX) if open(LOCK, "$s->{ConfDir}/LOCK");
+ if ( !open(HOST_INFO, "$s->{ConfDir}/hosts") ) {
+ print(STDERR "Can't open $s->{ConfDir}/hosts\n");
close(LOCK);
return {};
}
}
#
-# Writes new hosts information to the hosts file in $s->{TopDir}/conf/hosts.
+# Writes new hosts information to the hosts file in $s->{ConfDir}/hosts.
# With no argument a ref to a hash of hosts is returned. Each
# hash contains fields as specified in the hosts file. With an
# argument a ref to a single hash is returned with information
my($gotHdr, @fld, $hostText, $contents);
local(*HOST_INFO);
- if ( !open(HOST_INFO, "$s->{TopDir}/conf/hosts") ) {
- return "Can't open $s->{TopDir}/conf/hosts";
+ if ( !open(HOST_INFO, "$s->{ConfDir}/hosts") ) {
+ return "Can't open $s->{ConfDir}/hosts";
}
foreach my $host ( keys(%$hosts) ) {
my $name = "$hosts->{$host}{host}";
#
# Write and verify the new host file
#
- return $s->TextFileWrite("$s->{TopDir}/conf", "hosts", $contents);
+ return $s->TextFileWrite("$s->{ConfDir}/hosts", $contents);
}
#
sub HostsMTime
{
my($s) = @_;
- return (stat("$s->{TopDir}/conf/hosts"))[9];
+ return (stat("$s->{ConfDir}/hosts"))[9];
}
1;
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
--- /dev/null
+#============================================================= -*-perl-*-
+#
+# BackupPC::Xfer::BackupPCd package
+#
+# DESCRIPTION
+#
+# This library defines a BackupPC::Xfer::BackupPCd class for managing
+# the backuppcd-based transport of backup data from the client.
+#
+# AUTHOR
+# Craig Barratt <cbarratt@users.sourceforge.net>
+#
+# COPYRIGHT
+# Copyright (C) 2006 Craig Barratt
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#========================================================================
+#
+# Version 3.0.0alpha, released 23 Jan 2006.
+#
+# See http://backuppc.sourceforge.net.
+#
+#========================================================================
+
+package BackupPC::Xfer::BackupPCd;
+
+use strict;
+
+sub new
+{
+ my($class, $bpc, $args) = @_;
+
+ $args ||= {};
+ my $t = bless {
+ bpc => $bpc,
+ conf => { $bpc->Conf },
+ host => "",
+ hostIP => "",
+ shareName => "",
+ badFiles => [],
+
+ #
+ # Various stats
+ #
+ byteCnt => 0,
+ fileCnt => 0,
+ xferErrCnt => 0,
+ xferBadShareCnt => 0,
+ xferBadFileCnt => 0,
+ xferOK => 0,
+
+ #
+ # User's args
+ #
+ %$args,
+ }, $class;
+
+ return $t;
+}
+
+sub args
+{
+ my($t, $args) = @_;
+
+ foreach my $arg ( keys(%$args) ) {
+ $t->{$arg} = $args->{$arg};
+ }
+}
+
+sub useTar
+{
+ return 0;
+}
+
+sub start
+{
+ my($t) = @_;
+ my $bpc = $t->{bpc};
+ my $conf = $t->{conf};
+ my(@fileList, $bpcdCmd, $bpcdArgs, $logMsg, $incrDate,
+ $incrFlag, $restoreDir);
+
+ #
+ # We add a slash to the share name we pass to bpcd
+ #
+ ($t->{shareNameSlash} = "$t->{shareName}/") =~ s{//+$}{/};
+
+ if ( $t->{type} eq "restore" ) {
+ $bpcdCmd = $conf->{BackupPCdRestoreCmd};
+ $restoreDir = "$t->{shareName}/$t->{pathHdrDest}";
+ $restoreDir =~ s{//+}{/}g;
+ $logMsg = "restore started below directory $t->{shareName}"
+ . " to host $t->{host}";
+ } else {
+ if ( $t->{type} eq "full" ) {
+ if ( $t->{partialNum} ) {
+ $logMsg = "full backup started for directory $t->{shareName};"
+ . " updating partial $t->{partialNum}";
+ } else {
+ $logMsg = "full backup started for directory $t->{shareName}";
+ }
+ $incrFlag = 0;
+ } else {
+ #
+ # TODO: fix this message - just refer to the backup, not time?
+ #
+ $incrDate = $bpc->timeStamp($t->{lastFull} - 3600, 1);
+ $logMsg = "incr backup started back to $incrDate for directory"
+ . " $t->{shareName}";
+ $incrFlag = 1;
+ }
+ $bpcdCmd = $conf->{BackupPCdCmd};
+ }
+
+ #
+ # Merge variables into $bpcdCmd
+ #
+ my $args = {
+ host => $t->{host},
+ hostIP => $t->{hostIP},
+ client => $t->{client},
+ shareName => $t->{shareName},
+ shareNameSlash => $t->{shareNameSlash},
+ restoreDir => $restoreDir,
+ bpcdPath => $conf->{BackupPCdPath},
+ sshPath => $conf->{SshPath},
+ topDir => $bpc->TopDir(),
+ poolDir => $t->{compress} ? $bpc->{CPoolDir} : $bpc->{PoolDir},
+ poolCompress => $t->{compress} + 0,
+ incrFlag => $incrFlag,
+ };
+ $bpcdCmd = $bpc->cmdVarSubstitute($bpcdCmd, $args);
+
+ $t->{bpcdCmd} = $bpcdCmd;
+
+ delete($t->{_errStr});
+
+ return $logMsg;
+}
+
+sub run
+{
+ my($t) = @_;
+ my $bpc = $t->{bpc};
+ my $conf = $t->{conf};
+ my($remoteSend, $remoteDir, $remoteDirDaemon);
+ my $error;
+ my $stats;
+
+ # NO: alarm($conf->{ClientTimeout});
+
+ #
+ # Run backupcd command
+ #
+ my $str = "Running: "
+ . $t->{bpc}->execCmd2ShellCmd(@{$t->{bpcdCmd}})
+ . "\n";
+ $t->{XferLOG}->write(\$str);
+
+ #
+ #
+ #
+
+ $bpc->cmdSystemOrEvalLong($t->{bpcdCmd},
+ sub {
+ # write stdout to the XferLOG
+ my($str) = @_;
+ $t->{XferLOG}->write(\$str);
+ },
+ 0, # also catch stderr
+ $t->{pidHandler}
+ );
+
+ #
+ # TODO: generate sensible stats by parsing the output of
+ # backuppcd. Get error and fail status.
+ #
+ if ( !defined($error) && defined($stats) ) {
+ $t->{xferOK} = 1;
+ } else {
+ $t->{xferOK} = 0;
+ }
+ $t->{xferErrCnt} = $stats->{errorCnt};
+ $t->{byteCnt} = $stats->{TotalFileSize};
+ $t->{fileCnt} = $stats->{TotalFileCnt};
+ my $str = "Done: $t->{fileCnt} files, $t->{byteCnt} bytes\n";
+ $t->{XferLOG}->write(\$str);
+
+ $t->{hostError} = $error if ( defined($error) );
+
+ if ( $t->{type} eq "restore" ) {
+ return (
+ $t->{fileCnt},
+ $t->{byteCnt},
+ 0,
+ 0
+ );
+ } else {
+ return (
+ 0,
+ $stats->{ExistFileCnt},
+ $stats->{ExistFileSize},
+ $stats->{ExistFileCompSize},
+ $stats->{TotalFileCnt},
+ $stats->{TotalFileSize}
+ );
+ }
+}
+
+sub abort
+{
+ my($t, $reason) = @_;
+
+ # TODO
+ return 1;
+}
+
+sub errStr
+{
+ my($t) = @_;
+
+ return $t->{_errStr};
+}
+
+sub xferPid
+{
+ my($t) = @_;
+
+ return ();
+}
+
+#
+# Returns a hash ref giving various status information about
+# the transfer.
+#
+sub getStats
+{
+ my($t) = @_;
+
+ return { map { $_ => $t->{$_} }
+ qw(byteCnt fileCnt xferErrCnt xferBadShareCnt xferBadFileCnt
+ xferOK hostAbort hostError lastOutputLine)
+ };
+}
+
+sub getBadFiles
+{
+ my($t) = @_;
+
+ return @{$t->{badFiles}};
+}
+
+1;
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
my $owner = "$f->{uid}/$f->{gid}";
my $type = (("", "p", "c", "", "d", "", "b", "", "", "", "l", "", "s"))
[($f->{mode} & S_IFMT) >> 12];
- my $link;
+ my $name = $f->{name};
if ( ($f->{mode} & S_IFMT) == S_IFLNK ) {
- $link = " -> $f->{link}";
- } if ( ($f->{mode} & S_IFMT) == S_IFREG
+ $name .= " -> $f->{link}";
+ } elsif ( ($f->{mode} & S_IFMT) == S_IFREG
&& defined($f->{hlink}) && !$f->{hlink_self} ) {
- $link = " -> $f->{hlink}";
+ $name .= " -> $f->{hlink}";
}
+ $name =~ s/\n/\\n/g;
- $fio->log(sprintf(" %-6s %1s%4o %9s %11.0f %s%s",
+ $fio->log(sprintf(" %-6s %1s%4o %9s %11.0f %s",
$action,
$type,
$f->{mode} & 07777,
$owner,
$f->{size},
- $f->{name},
- $link));
+ $name));
}
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
#========================================================================
#
-# Version 2.1.0, released 20 Jun 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
#
# dist/BackupPC-$Version.tar.gz.
#
+# Often the language files are not up to date, and makeDist
+# exits after complaining about the lang files being inconsistent.
+# Use the -l option to turn off that behavior.
+#
# AUTHOR
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2001-2004 Craig Barratt
+# Copyright (C) 2001-2006 Craig Barratt
#
# 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
lib/BackupPC/Lang/pt_br.pm
lib/BackupPC/Storage/Text.pm
lib/BackupPC/Xfer/Archive.pm
+ lib/BackupPC/Xfer/BackupPCd.pm
lib/BackupPC/Xfer/Smb.pm
lib/BackupPC/Xfer/Tar.pm
lib/BackupPC/Xfer/Rsync.pm
} elsif ( /^use lib ".*BackupPC\/lib";/
|| /^use lib "\/home\/pcbackup\/install\/lib";/ ) {
print OUT "use lib \"__INSTALLDIR__/lib\";\n";
- } elsif ( $file =~ /Lib.pm/ && /(.*TopDir *=> .*)'.*',/ ) {
- print OUT "$1'__TOPDIR__',\n";
+ } elsif ( $file =~ /Lib.pm/ && /^(\s*\$topDir\s*=\s*)'.*'(\s*if\s.*)/ ) {
+ print OUT "$1'__TOPDIR__'$2\n";
+ } elsif ( $file =~ /Lib.pm/ && /^(\s*\$installDir\s*=\s*)'.*'(\s*if\s.*)/ ) {
+ print OUT "$1'__INSTALLDIR__'$2\n";
+ } elsif ( $file =~ /Lib.pm/ && /^(\s*my \$useFHS\s*=\s*)\d;/ ) {
+ print OUT "${1}__USEFHS__;\n";
} elsif ( $file =~ /Lib.pm/ && /(.*Version *=> .*)'[\w\d\.]+',/ ) {
print OUT "$1'$Version',\n";
- } elsif ( $file =~ /Lib.pm/ && /(.*BinDir *=> .*)'.*',/ ) {
- print OUT "$1'__INSTALLDIR__',\n";
- } elsif ( $file =~ /Lib.pm/ && /(.*LibDir *=> .*)'.*',/ ) {
- print OUT "$1'__INSTALLDIR__',\n";
} elsif ( $file =~ /BackupPC_Admin/ && /(my *\$installDir *= *)'.*'/ ) {
print OUT "$1'__INSTALLDIR__/lib';\n";
} else {