30 |
my $host = 'restore'; |
my $host = 'restore'; |
31 |
my $share = '/etc'; |
my $share = '/etc'; |
32 |
|
|
33 |
|
# this option will cleanup tar dump before import of each increment |
34 |
|
# WARNING: this will create increments which contain only new files, not |
35 |
|
# state of share in that particular moment! (it's fast, though) |
36 |
|
my $cleanup_before_increment = 0; |
37 |
|
|
38 |
# connect to BackupPC_server |
# connect to BackupPC_server |
39 |
|
|
40 |
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); |
die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) ); |
61 |
# take care of temporary directory for increments |
# take care of temporary directory for increments |
62 |
|
|
63 |
my $inc_tmp_dir = $Conf{IncrementTempDir} || die "need working directory in IncrementTempDir\n"; |
my $inc_tmp_dir = $Conf{IncrementTempDir} || die "need working directory in IncrementTempDir\n"; |
|
rmtree($inc_tmp_dir) if (-e $inc_tmp_dir); |
|
64 |
|
|
65 |
mkpath($inc_tmp_dir); |
sub cleanup_inc_temp_dir { |
66 |
|
rmtree($inc_tmp_dir) if (-e $inc_tmp_dir); |
67 |
|
mkpath($inc_tmp_dir); |
68 |
|
} |
69 |
|
|
70 |
print "# using $inc_tmp_dir for increment scratch space"; |
print "# using $inc_tmp_dir for increment scratch space"; |
71 |
|
cleanup_inc_temp_dir() if (! $cleanup_before_increment); |
72 |
|
|
73 |
# create restore host configuration |
# create restore host configuration |
74 |
|
|
116 |
|
|
117 |
print "restoring $path\n"; |
print "restoring $path\n"; |
118 |
|
|
119 |
|
cleanup_inc_temp_dir() if ($cleanup_before_increment); |
120 |
|
|
121 |
my $cmd = "cd $inc_tmp_dir && tar xfz $path"; |
my $cmd = "cd $inc_tmp_dir && tar xfz $path"; |
122 |
system($cmd) == 0 or die "can't execute: $cmd -- $?\n"; |
system($cmd) == 0 or die "can't execute: $cmd -- $?\n"; |
123 |
|
|