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.0_CVS, released 3 Jul 2003.
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
100 archiveloc => $t->{archiveloc},
101 parfile => $t->{parfile},
102 compression => $t->{compression},
103 compext => $t->{compext},
104 splitsize => $t->{splitsize},
105 host => ${@HostList[0]}[$i],
106 backupnumber => ${@BackupList[0]}[$i],
107 Installdir => $conf->{InstallDir},
108 tarCreatePath => $tarCreatePath,
109 splitpath => $conf->{SplitPath},
110 parpath => $conf->{ParPath},
113 $archiveClientCmd2 = $bpc->cmdVarSubstitute($archiveClientCmd, $cmdargs);
114 $t->{XferLOG}->write(\"Executing: @$archiveClientCmd2\n");
116 $bpc->cmdSystemOrEval($archiveClientCmd2,
118 $t->{XferLOG}->write(\$_[0]);
123 $t->{XferLOG}->write(\"Completed Archive\n");
124 return "Completed Archive";
131 return $t->{_errStr};
138 return ($t->{xferPid});
145 push(@{$t->{_logMsg}}, $msg);
152 return shift(@{$t->{_logMsg}});