1 #============================================================= -*-perl-*-
3 # BackupPC::Xfer::Archive package
7 # This library defines a BackupPC::Xfer::Archive class for managing
11 # Craig Barratt <cbarratt@users.sourceforge.net>
14 # Copyright (C) 2001-2003 Craig Barratt
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #========================================================================
32 # Version 2.1.0beta2, released 23 May 2004.
34 # See http://backuppc.sourceforge.net.
36 #========================================================================
38 package BackupPC::Xfer::Archive;
44 my($class, $bpc, $args) = @_;
49 conf => { $bpc->Conf },
66 foreach my $arg ( keys(%$args) ) {
67 $t->{$arg} = $args->{$arg};
78 return "Archive Started";
85 my $conf = $t->{conf};
87 my(@HostList, @BackupList, $archiveClientCmd, $archiveClientCmd2, $logMsg);
89 $archiveClientCmd = $conf->{ArchiveClientCmd};
91 @HostList = $t->{HostList};
92 @BackupList = $t->{BackupList};
94 my $tarCreatePath = "$conf->{InstallDir}/bin/BackupPC_tarCreate";
95 while (${@HostList[0]}[$i]) {
97 # Merge variables into @archiveClientCmd
101 archiveloc => $t->{archiveloc},
102 parfile => $t->{parfile},
103 compression => $t->{compression},
104 compext => $t->{compext},
105 splitsize => $t->{splitsize},
106 host => ${@HostList[0]}[$i],
107 backupnumber => ${@BackupList[0]}[$i],
108 Installdir => $conf->{InstallDir},
109 tarCreatePath => $tarCreatePath,
110 splitpath => $conf->{SplitPath},
111 parpath => $conf->{ParPath},
114 $archiveClientCmd2 = $bpc->cmdVarSubstitute($archiveClientCmd,
116 $t->{XferLOG}->write(\"Executing: @$archiveClientCmd2\n");
118 $bpc->cmdSystemOrEval($archiveClientCmd2,
121 $t->{XferLOG}->write(\$_[0]);
124 ($t->{_errStr} = $errStr) =~ s/[\n\r]+//;
129 $t->{XferLOG}->write(\"Completed Archive\n");
130 return "Completed Archive";
137 return $t->{_errStr};
148 return ($t->{xferPid});
155 push(@{$t->{_logMsg}}, $msg);
162 return shift(@{$t->{_logMsg}});