projects
/
BackupPC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various changes, including changes in 2.1.1 and 2.1.2 releases.
[BackupPC.git]
/
bin
/
BackupPC_restore
diff --git
a/bin/BackupPC_restore
b/bin/BackupPC_restore
index
56d8b79
..
2015df8
100755
(executable)
--- a/
bin/BackupPC_restore
+++ b/
bin/BackupPC_restore
@@
-1,4
+1,4
@@
-#!/bin/perl
-T
+#!/bin/perl
#============================================================= -*-perl-*-
#
# BackupPC_restore: Restore files to a client.
#============================================================= -*-perl-*-
#
# BackupPC_restore: Restore files to a client.
@@
-29,7
+29,7
@@
#
#========================================================================
#
#
#========================================================================
#
-# Version 2.1.0
_CVS, released 3 Jul 2003
.
+# Version 2.1.0
, released 20 Jun 2004
.
#
# See http://backuppc.sourceforge.net.
#
#
# See http://backuppc.sourceforge.net.
#
@@
-186,7
+186,10
@@
if ( (my $errMsg = CorrectHostCheck($hostIP, $host)) ) {
#
# Setup file extension for compression and open RestoreLOG output file
#
#
# Setup file extension for compression and open RestoreLOG output file
#
-$Conf{CompressLevel} = 0 if ( !BackupPC::FileZIO->compOk );
+if ( $Conf{CompressLevel} && !BackupPC::FileZIO->compOk ) {
+ $stat{hostError} = "Compress:Zlib not found";
+ exit(RestoreCleanup($client));
+}
my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : "";
my $RestoreLOG = BackupPC::FileZIO->open("$Dir/RestoreLOG$fileExt", 1,
$Conf{CompressLevel});
my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : "";
my $RestoreLOG = BackupPC::FileZIO->open("$Dir/RestoreLOG$fileExt", 1,
$Conf{CompressLevel});
@@
-264,6
+267,7
@@
my $xferArgs = {
pipeWH => *WH,
XferLOG => $RestoreLOG,
XferMethod => $Conf{XferMethod},
pipeWH => *WH,
XferLOG => $RestoreLOG,
XferMethod => $Conf{XferMethod},
+ logLevel => $Conf{XferLogLevel},
bkupSrcHost => $RestoreReq{hostSrc},
bkupSrcShare => $RestoreReq{shareSrc},
bkupSrcNum => $RestoreReq{num},
bkupSrcHost => $RestoreReq{hostSrc},
bkupSrcShare => $RestoreReq{shareSrc},
bkupSrcNum => $RestoreReq{num},
@@
-332,6
+336,7
@@
if ( $useTar ) {
open(STDERR, ">&STDOUT");
close(STDOUT);
open(STDOUT, ">&WH");
open(STDERR, ">&STDOUT");
close(STDOUT);
open(STDOUT, ">&WH");
+ alarm(0);
exec("$BinDir/BackupPC_tarCreate", @tarArgs);
print(LOG $bpc->timeStamp, "can't exec $BinDir/BackupPC_tarCreate\n");
# FIX: need to cleanup xfer
exec("$BinDir/BackupPC_tarCreate", @tarArgs);
print(LOG $bpc->timeStamp, "can't exec $BinDir/BackupPC_tarCreate\n");
# FIX: need to cleanup xfer
@@
-492,17
+497,17
@@
sub RestoreCleanup
# kill off the tranfer program, first nicely then forcefully
#
if ( @xferPid ) {
# kill off the tranfer program, first nicely then forcefully
#
if ( @xferPid ) {
- kill(
2
, @xferPid);
+ kill(
$bpc->sigName2num("INT")
, @xferPid);
sleep(1);
sleep(1);
- kill(
9
, @xferPid);
+ kill(
$bpc->sigName2num("KILL")
, @xferPid);
}
#
# kill off the tar process, first nicely then forcefully
#
if ( $tarPid > 0 ) {
}
#
# kill off the tar process, first nicely then forcefully
#
if ( $tarPid > 0 ) {
- kill(
2
, $tarPid);
+ kill(
$bpc->sigName2num("INT")
, $tarPid);
sleep(1);
sleep(1);
- kill(
9
, $tarPid);
+ kill(
$bpc->sigName2num("KILL")
, $tarPid);
}
}
}
}
@@
-609,9
+614,9
@@
sub pidHandler
#
sub UserCommandRun
{
#
sub UserCommandRun
{
- my($
t
ype) = @_;
+ my($
cmdT
ype) = @_;
- return if ( !defined($Conf{$
t
ype}) );
+ return if ( !defined($Conf{$
cmdT
ype}) );
my $vars = {
xfer => $xfer,
client => $client,
my $vars = {
xfer => $xfer,
client => $client,
@@
-626,7
+631,8
@@
sub UserCommandRun
XferLOG => $RestoreLOG,
stat => \%stat,
xferOK => $stat{xferOK} || 0,
XferLOG => $RestoreLOG,
stat => \%stat,
xferOK => $stat{xferOK} || 0,
- type => $type,
+ hostError => $stat{hostError},
+ type => "restore",
bkupSrcHost => $RestoreReq{hostSrc},
bkupSrcShare => $RestoreReq{shareSrc},
bkupSrcNum => $RestoreReq{num},
bkupSrcHost => $RestoreReq{hostSrc},
bkupSrcShare => $RestoreReq{shareSrc},
bkupSrcNum => $RestoreReq{num},
@@
-634,9
+640,10
@@
sub UserCommandRun
pathHdrSrc => $RestoreReq{pathHdrSrc},
pathHdrDest => $RestoreReq{pathHdrDest},
fileList => $RestoreReq{fileList},
pathHdrSrc => $RestoreReq{pathHdrSrc},
pathHdrDest => $RestoreReq{pathHdrDest},
fileList => $RestoreReq{fileList},
+ cmdType => $cmdType,
};
};
- my $cmd = $bpc->cmdVarSubstitute($Conf{$
t
ype}, $vars);
- $RestoreLOG->write(\"Executing $
t
ype: @$cmd\n");
+ my $cmd = $bpc->cmdVarSubstitute($Conf{$
cmdT
ype}, $vars);
+ $RestoreLOG->write(\"Executing $
cmdT
ype: @$cmd\n");
#
# Run the user's command, dumping the stdout/stderr into the
# Xfer log file. Also supply the optional $vars and %Conf in
#
# Run the user's command, dumping the stdout/stderr into the
# Xfer log file. Also supply the optional $vars and %Conf in