X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_restore;h=2015df80213592afde932e88f6489f72d691bd90;hp=9ebd8c45c831dca03ba6104261be4a849e2cfedc;hb=17dcbbebb871212f90b81bb97f8d1feb528bdc43;hpb=2c14784ad71874ec850d189060fe63d6eb9eba95 diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore index 9ebd8c4..2015df8 100755 --- a/bin/BackupPC_restore +++ b/bin/BackupPC_restore @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0_CVS, released 8 Feb 2004. +# Version 2.1.0, released 20 Jun 2004. # # 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 # -$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}); @@ -264,6 +267,7 @@ my $xferArgs = { pipeWH => *WH, XferLOG => $RestoreLOG, XferMethod => $Conf{XferMethod}, + logLevel => $Conf{XferLogLevel}, bkupSrcHost => $RestoreReq{hostSrc}, bkupSrcShare => $RestoreReq{shareSrc}, bkupSrcNum => $RestoreReq{num}, @@ -493,17 +497,17 @@ sub RestoreCleanup # kill off the tranfer program, first nicely then forcefully # if ( @xferPid ) { - kill(2, @xferPid); + kill($bpc->sigName2num("INT"), @xferPid); sleep(1); - kill(9, @xferPid); + kill($bpc->sigName2num("KILL"), @xferPid); } # # kill off the tar process, first nicely then forcefully # if ( $tarPid > 0 ) { - kill(2, $tarPid); + kill($bpc->sigName2num("INT"), $tarPid); sleep(1); - kill(9, $tarPid); + kill($bpc->sigName2num("KILL"), $tarPid); } } @@ -610,9 +614,9 @@ sub pidHandler # sub UserCommandRun { - my($type) = @_; + my($cmdType) = @_; - return if ( !defined($Conf{$type}) ); + return if ( !defined($Conf{$cmdType}) ); my $vars = { xfer => $xfer, client => $client, @@ -628,7 +632,7 @@ sub UserCommandRun stat => \%stat, xferOK => $stat{xferOK} || 0, hostError => $stat{hostError}, - type => $type, + type => "restore", bkupSrcHost => $RestoreReq{hostSrc}, bkupSrcShare => $RestoreReq{shareSrc}, bkupSrcNum => $RestoreReq{num}, @@ -636,9 +640,10 @@ sub UserCommandRun pathHdrSrc => $RestoreReq{pathHdrSrc}, pathHdrDest => $RestoreReq{pathHdrDest}, fileList => $RestoreReq{fileList}, + cmdType => $cmdType, }; - my $cmd = $bpc->cmdVarSubstitute($Conf{$type}, $vars); - $RestoreLOG->write(\"Executing $type: @$cmd\n"); + my $cmd = $bpc->cmdVarSubstitute($Conf{$cmdType}, $vars); + $RestoreLOG->write(\"Executing $cmdType: @$cmd\n"); # # Run the user's command, dumping the stdout/stderr into the # Xfer log file. Also supply the optional $vars and %Conf in