- fixed a typo that caused incPartsUpdate not to work properly
[BackupPC.git] / bin / BackupPC_burnArchiveCLI
index 31b6209..399e2a4 100755 (executable)
@@ -1,7 +1,8 @@
 #!/usr/local/bin/perl
 
 use strict;
-use lib "/data/backuppc-agi//lib";
+
+use lib "__INSTALLDIR__/lib";
 
 use DBI;
 use BackupPC::Lib;
@@ -481,15 +482,22 @@ foreach my $copy_nr ( 1 .. $copies ) {
                                                my $host = $p->{host};
                                                my $share = $p->{share};
                                                my $dump = $p->{num};
-                                               my $otherUser = "backuppc-agi";
-
-                                               my $cmd = "sudo -u $otherUser ".$tarIncCreate. " -h $host -s $share -n $dump";
-                                               print "$cmd ";
-                                               if (system($cmd) != 0) {
-                                                       print " FAILED.\n";
-                                               } else {
-                                                       print " done.\n";
+                                               my $currUser = getlogin();
+                                               my $otherUser = "";
+                                               if ($currUser eq "agi") {
+                                                       $otherUser = "backuppc-agi";
+                                               } elsif ($currUser eq "qc") {
+                                                       $otherUser = "backuppc-qc";
+                                               }
+                                               if ($otherUser ne "") {
+                                                       my $cmd = "sudo -u $otherUser ".$tarIncCreate. " -h $host -s $share -n $dump";
+                                                       print "$cmd ";
+                                                       if (system($cmd) != 0) {
+                                                               print " FAILED.\n";
+                                                       } else {
+                                                               print " done.\n";
                                                }
+                                       }       
                                        }
 
                                        skip "can't find increment $rel_path, recreateing obviously did not work: $!" unless (-r "$tar_dir/$rel_path");