TAR exclude options
authorJamie Cameron <jcameron@webmin.com>
Mon, 18 Feb 2008 21:03:28 +0000 (21:03 +0000)
committerJamie Cameron <jcameron@webmin.com>
Mon, 18 Feb 2008 21:03:28 +0000 (21:03 +0000)
fsdump/CHANGELOG
fsdump/help/exclude.html [new file with mode: 0644]
fsdump/lang/en
fsdump/linux-lib.pl

index a9c5441..4b1f03a 100644 (file)
@@ -31,3 +31,4 @@ Added a warning if % is used in filenames but strftime substition is not enabled
 When making tar format backups on Linux, an option to just append new files to the archive instead of over-writing it is available.
 ---- Changes since 1.400 ----
 Fixed remote tar backups via FTP on OSX.
+Files and directories to exclude can be specified for TAR format backups on Linux.
diff --git a/fsdump/help/exclude.html b/fsdump/help/exclude.html
new file mode 100644 (file)
index 0000000..4b6e9e8
--- /dev/null
@@ -0,0 +1,6 @@
+<header>Files and directories to skip</header>
+
+This field can be used to enter a list of space-separated filenames to exclude from the backup. You can also enter full paths like <tt>/etc/passwd</tt>, or shell patterns like <tt>*.tmp</tt>. <p>
+
+<footer>
+
index 7fe62db..6137baa 100644 (file)
@@ -37,6 +37,7 @@ dump_level_0=(Full backup)
 dump_label=Backup label
 dump_multi=Split across multiple files?
 dump_update=Update <tt>/etc/dumpdates</tt> file?
+dump_exclude=Files and directories to skip
 dump_edir=Missing or invalid directory to backup
 dump_efile=Missing file or device to backup to
 dump_ehost=Missing or invalid host to backup to
index 13fe1d3..2778e04 100644 (file)
@@ -69,6 +69,10 @@ if ($_[0]->{'fs'} eq 'tar') {
                                            $text{'dump_auto'})." kB",
                            3, $tds);
 
+       print &ui_table_row(&hlink($text{'dump_exclude'}, "exclude"),
+                           &ui_textbox("exclude", $_[0]->{'exclude'}, 50),
+                           3, $tds);
+
        print &ui_table_row(&hlink($text{'dump_gzip'},"gzip"),
                            &ui_select("gzip", int($_[0]->{'gzip'}),
                                [ [ 0, $text{'no'} ],
@@ -225,6 +229,7 @@ if ($_[0]->{'fs'} eq 'tar') {
                $_[0]->{'blocks'} = $in{'blocks'};
                $in{'gzip'} && &error($text{'dump_egzip'});
                }
+       $_[0]->{'exclude'} = $in{'exclude'};
        $_[0]->{'gzip'} = $in{'gzip'};
        $_[0]->{'multi'} = $in{'multi'};
        $_[0]->{'links'} = $in{'links'};
@@ -340,6 +345,11 @@ if ($_[0]->{'fs'} eq 'tar') {
        $cmd .= " -F \"$tapecmd $_[0]->{'id'}\"" if (!$_[0]->{'gzip'} && $tapecmd);
        $cmd .= " --rsh-command=".quotemeta($_[0]->{'rsh'}) if ($_[0]->{'rsh'});
        $cmd .= " --rmt-command=".quotemeta($_[0]->{'rmt'}) if ($_[0]->{'rmt'});
+       if ($_[0]->{'exclude'}) {
+               foreach my $e (&split_quoted_string($_[0]->{'exclude'})) {
+                       $cmd .= " --exclude ".quotemeta($e);
+                       }
+               }
        $cmd .= " $_[0]->{'extra'}" if ($_[0]->{'extra'});
        $cmd .= " ".join(" ", map { "'$_'" } @dirs);
        }