r10309@llin: dpavlin | 2006-03-07 11:48:22 +0100
[BackupPC.git] / bin / BackupPC_recover_from_increments
index a1535b8..d8e505a 100755 (executable)
@@ -43,11 +43,13 @@ if ( $err ) {
 
 my $TopDir = $bpc->TopDir();
 
-print Dumper(\%Conf);
+#print Dumper(\%Conf);
 
 # check if host exists
 
-die "host $host is not found" unless ($bpc->HostInfoRead( $host ));
+my $host_info = $bpc->HostInfoRead( $host );
+print Dumper($host_info, $bpc->HostInfoRead( 'localhost' ));
+die "host '$host' is not found, please add it to config/hosts configuration file\n" unless ($host_info->{$host});
 
 # create restore host configuration
 
@@ -62,6 +64,7 @@ $Conf{TarIncrArgs} = '';
 
 # fake ping when restoring
 $Conf{PingCmd} = '$pingPath -c 1 localhost',
+$Conf{ClientNameAlias} = 'localhost';
 
 $Conf{TarClientCmd} = 'zcat __restore_path__';
 
@@ -89,10 +92,12 @@ sub restore_increment {
        }
        link $path, $restore_path || die "can't create link $path -> $restore_path: $!\n";
 
-       $bpc->ServerMesg("log User backuppc started restore of $path");
+       my $user = $host_info->{$host}->{user} || die "can't get user for host $host";
+
+       $bpc->ServerMesg("log User $user started recovery from increment $path");
 
        my $full = 0;
-       my $r = $bpc->ServerMesg("backup $host $host backuppc $full");
+       my $r = $bpc->ServerMesg("backup $host $host $user $full");
        print "backup --> $r";
        die $r if ($r =~ m/^error/);