r10309@llin: dpavlin | 2006-03-07 11:48:22 +0100
[BackupPC.git] / bin / BackupPC_recover_from_increments
index c3e338d..d8e505a 100755 (executable)
@@ -48,8 +48,8 @@ my $TopDir = $bpc->TopDir();
 # check if host exists
 
 my $host_info = $bpc->HostInfoRead( $host );
-#print Dumper($host_info, $bpc->HostInfoRead( 'localhost' ));
-die "host '$host' is not found\n" unless ($host_info->{$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
 
@@ -64,6 +64,7 @@ $Conf{TarIncrArgs} = '';
 
 # fake ping when restoring
 $Conf{PingCmd} = '$pingPath -c 1 localhost',
+$Conf{ClientNameAlias} = 'localhost';
 
 $Conf{TarClientCmd} = 'zcat __restore_path__';
 
@@ -91,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/);