Fixes for 'backup.pl' (Bug #11816)
authorMatthias Fischer <matthias.fischer@ipfire.org>
Tue, 14 Aug 2018 19:34:38 +0000 (21:34 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 14 Aug 2018 19:38:47 +0000 (20:38 +0100)
Hi,

Fixes #11816
(https://bugzilla.ipfire.org/show_bug.cgi?id=11816 and
https://bugzilla.ipfire.org/attachment.cgi?id=608):

"[root@ipfire ~]# backupctrl exclude
...
tar: The following options were used after any non-optional arguments in
archive create or update mode.  These options are positional and affect
only arguments that follow them.  Please, rearrange them properly.
tar: --exclude-from '/var/ipfire/backup/exclude.user' has no effect
tar: Exiting with failure status due to previous errors"

Please test - I got no errors anymore.

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/backup/backup.pl

index d430f34..ce16e7f 100644 (file)
@@ -46,7 +46,7 @@ if (($ARGV[0] eq 'include') || ($ARGV[0] eq 'iso')) {
   print DATEI @include;
   print "/var/log/messages";
   close(DATEI);
-  system("tar -cvzf /var/ipfire/backup/$Jahr$Monat$Monatstag-$Stunden$Minuten.ipf --files-from='/tmp/include' --exclude-from='/var/ipfire/backup/exclude' --files-from='/var/ipfire/backup/include.user' --exclude-from='/var/ipfire/backup/exclude.user'");
+  system("tar -cvzf /var/ipfire/backup/$Jahr$Monat$Monatstag-$Stunden$Minuten.ipf --exclude-from='/var/ipfire/backup/exclude' --exclude-from='/var/ipfire/backup/exclude.user' --files-from='/tmp/include' --files-from='/var/ipfire/backup/include.user'");
   system("rm /tmp/include");
   if ($ARGV[0] eq 'iso') {
        system("/usr/local/bin/backupiso $Jahr$Monat$Monatstag-$Stunden$Minuten &");
@@ -57,7 +57,7 @@ elsif ($ARGV[0] eq 'exclude') {
   open(DATEI, ">/tmp/include") || die "Could not save temp include file";
   print DATEI @include;
   close(DATEI);
-  system("tar -cvzf /var/ipfire/backup/$Jahr$Monat$Monatstag-$Stunden$Minuten.ipf --files-from='/tmp/include' --exclude-from='/var/ipfire/backup/exclude' --files-from='/var/ipfire/backup/include.user' --exclude-from='/var/ipfire/backup/exclude.user'");
+  system("tar -cvzf /var/ipfire/backup/$Jahr$Monat$Monatstag-$Stunden$Minuten.ipf --exclude-from='/var/ipfire/backup/exclude' --exclude-from='/var/ipfire/backup/exclude.user' --files-from='/tmp/include' --files-from='/var/ipfire/backup/include.user'");
   system("rm /tmp/include");
 }
 elsif ($ARGV[0] eq 'restore') {
@@ -158,7 +158,7 @@ sub createinclude(){
   open(DATEI, "<${General::swroot}/backup/include") || die "Can not open include file";
   my @Zeilen = <DATEI>;
   close(DATEI);
-  
+
   foreach (@Zeilen){
     chomp($_);
     my @files = `find $_ -maxdepth 0 2>/dev/null`;