Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 184560 | Differences between
and this patch

Collapse All | Expand All

(-)flexbackup (-16 / +20 lines)
Lines 1301-1308 Link Here
1301
	$cmd .= "$::unz";
1301
	$cmd .= "$::unz";
1302
    }
1302
    }
1303
    $cmd .= "(";
1303
    $cmd .= "(";
1304
    $cmd .= "mkdir -p $::device ; ";
1304
    $cmd .= "mkdir -p \"$::device\" ; ";
1305
    $cmd .= "cd $::device ; ";
1305
    $cmd .= "cd \"$::device\" ; ";
1306
    $cmd .= "$::path{cpio} -i ";
1306
    $cmd .= "$::path{cpio} -i ";
1307
    $cmd .= "-m ";
1307
    $cmd .= "-m ";
1308
    $cmd .= "-d ";
1308
    $cmd .= "-d ";
Lines 1351-1359 Link Here
1351
1351
1352
    # Have to take leading './' off to make rsync's include/exclude work right
1352
    # Have to take leading './' off to make rsync's include/exclude work right
1353
    $cmd .= " | $::path{sed} -e \"s/\\.\\///g\" | ";
1353
    $cmd .= " | $::path{sed} -e \"s/\\.\\///g\" | ";
1354
1355
    $cmd .= "$::path{rsync} ";
1354
    $cmd .= "$::path{rsync} ";
1356
    $cmd .= "--include-from=- --exclude=* ";
1355
    $cmd .= "--files-from=- ";
1357
    $cmd .= "--archive ";
1356
    $cmd .= "--archive ";
1358
    $cmd .= "$::rsync_verb_flag ";
1357
    $cmd .= "$::rsync_verb_flag ";
1359
    $cmd .= "--delete --delete-excluded ";
1358
    $cmd .= "--delete --delete-excluded ";
Lines 1368-1374 Link Here
1368
	    $cmd .= "$remote:";
1367
	    $cmd .= "$remote:";
1369
	}
1368
	}
1370
    }
1369
    }
1371
    $cmd .= "$dir/ $::device";
1370
    $cmd .= "\"$dir/\" \"$::device\"";
1372
1371
1373
    push(@cmds, $cmd);
1372
    push(@cmds, $cmd);
1374
1373
Lines 1658-1664 Link Here
1658
    my $tmpfile = "$cfg::tmpdir/ar.$PROCESS_ID";
1657
    my $tmpfile = "$cfg::tmpdir/ar.$PROCESS_ID";
1659
    my $remove = '';
1658
    my $remove = '';
1660
1659
1661
    &log("| NOTE: ar archives will not descend directories");
1660
    &log("| NOTE: ar archives will not recurse into subdirectories,");
1661
    &log("|       which makes them inappropriate for most backups.");
1662
    &log("|       Be sure this is what you want.");
1662
1663
1663
    if (defined($remote) and ($level != 0)) {
1664
    if (defined($remote) and ($level != 0)) {
1664
	my $time = &get_last_date($label, $level, 'numeric');
1665
	my $time = &get_last_date($label, $level, 'numeric');
Lines 1682-1692 Link Here
1682
    $cmd = "cd \"$dir\" && ";
1683
    $cmd = "cd \"$dir\" && ";
1683
    $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote, '-maxdepth 1 ! -type d');
1684
    $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote, '-maxdepth 1 ! -type d');
1684
    $cmd .= "> $filelist; ";
1685
    $cmd .= "> $filelist; ";
1686
    # Escape any spaces in filenames. 
1687
    $cmd .= "$::path{sed} -i -e 's/ /\\\\ /g' $filelist; ";
1685
1688
1686
    $cmd .= "$::path{ar} rc";
1689
    $cmd .= "$::path{ar} rc";
1687
    $cmd .= "$::ar_verb_flag ";
1690
    $cmd .= "$::ar_verb_flag ";
1688
    $cmd .= "$tmpfile ";
1691
    $cmd .= "$tmpfile ";
1689
    $cmd .= "`$::path{cat} $filelist`";
1692
    $cmd .= "\@$filelist ";
1690
    $cmd .= "; $::path{cat} $tmpfile $::z";
1693
    $cmd .= "; $::path{cat} $tmpfile $::z";
1691
1694
1692
    # Buffer both sides if remote
1695
    # Buffer both sides if remote
Lines 1800-1811 Link Here
1800
1803
1801
    $cmd = "cd \"$dir\" && ";
1804
    $cmd = "cd \"$dir\" && ";
1802
    $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote);
1805
    $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote);
1803
    $cmd .= "> $filelist; ";
1806
    $cmd .= " | $::path{lha} a";
1804
1805
    $cmd .= "$::path{lha} a";
1806
    $cmd .= "$::lha_verb_flag ";
1807
    $cmd .= "$::lha_verb_flag ";
1807
    $cmd .= "$tmpfile ";
1808
    $cmd .= "$tmpfile ";
1808
    $cmd .= "`$::path{cat} $filelist`";
1809
    $cmd .= "; $::path{cat} $tmpfile $::z";
1809
    $cmd .= "; $::path{cat} $tmpfile $::z";
1810
1810
1811
    # Buffer both sides if remote
1811
    # Buffer both sides if remote
Lines 2766-2771 Link Here
2766
    $::path{'dd'} = &checkinpath('dd');
2766
    $::path{'dd'} = &checkinpath('dd');
2767
    $::path{'printf'} = &checkinpath('printf');
2767
    $::path{'printf'} = &checkinpath('printf');
2768
    $::path{'mkdir'} = &checkinpath('mkdir');
2768
    $::path{'mkdir'} = &checkinpath('mkdir');
2769
	$::path{'sed'} = &checkinpath('sed');
2769
2770
2770
    push(@::remoteprogs,($::path{'touch'},$::path{'rm'},$::path{'find'},$::path{'printf'},$::path{'mkdir'}));
2771
    push(@::remoteprogs,($::path{'touch'},$::path{'rm'},$::path{'find'},$::path{'printf'},$::path{'mkdir'}));
2771
2772
Lines 4894-4902 Link Here
4894
			$rex .= '\)"';
4895
			$rex .= '\)"';
4895
		}
4896
		}
4896
		# Show what the darn thing is constructing for prune expressions.
4897
		# Show what the darn thing is constructing for prune expressions.
4897
		&log("| \"find\" regex for pruning is:");
4898
        (my $temp = $rex) =~ s/\\([()|])/$1/g;
4898
		&log("|     $rex");
4899
		&log("| \"find\" regex for pruning (shell escaping omitted for clarity) is:");
4899
		&line();
4900
		&log("|     $temp");
4900
		$cmd .= '-regex ' . $rex . ' -prune -o ';
4901
		$cmd .= '-regex ' . $rex . ' -prune -o ';
4901
    } else {
4902
    } else {
4902
		# Show what the darn thing is constructing for prune expressions.
4903
		# Show what the darn thing is constructing for prune expressions.
Lines 4906-4911 Link Here
4906
		# don't have permissions on and are running as non-root)
4907
		# don't have permissions on and are running as non-root)
4907
		$cmd .= "-depth ";
4908
		$cmd .= "-depth ";
4908
    }
4909
    }
4910
    &line();
4909
4911
4910
    $cmd .= "$::mountpoint_flag ";
4912
    $cmd .= "$::mountpoint_flag ";
4911
    $cmd .= "! -type s ";
4913
    $cmd .= "! -type s ";
Lines 5301-5312 Link Here
5301
	print $::msg "| Checking '$cfg::buffer' on this machine... ";
5303
	print $::msg "| Checking '$cfg::buffer' on this machine... ";
5302
	$pipecmd = "sh $tmp_script ";
5304
	$pipecmd = "sh $tmp_script ";
5303
    } else {
5305
    } else {
5306
	$pipecmd = 
5307
        "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; " .
5308
        "cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; " .
5309
        "sh $tmp_script; rm -rf $cfg::tmpdir')";
5304
	print $::msg "| Checking '$cfg::buffer' on host $host... ";
5310
	print $::msg "| Checking '$cfg::buffer' on host $host... ";
5305
	$pipecmd =  "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; sh $tmp_script; rm -rf $cfg::tmpdir')";
5306
    }
5311
    }
5307
5312
5308
    if (!defined($::debug)) {
5313
    if (!defined($::debug)) {
5309
5310
	open(PIPE,"$pipecmd |") || die;
5314
	open(PIPE,"$pipecmd |") || die;
5311
5315
5312
	$explicit_success = 0;
5316
	$explicit_success = 0;
(-)flexbackup.conf (-15 / +30 lines)
Lines 12-30 Link Here
12
12
13
# Configure backup "sets".
13
# Configure backup "sets".
14
# Not needed if you use "-dir <dir>" to backup one tree at a time.
14
# Not needed if you use "-dir <dir>" to backup one tree at a time.
15
# Each set is a simple space-separated list of filesystems
15
# Each set is a simple space-separated list of filesystems.  Remote filesystems
16
# Remote filesystems should denoted as 'host:dir'
16
# should denoted as 'host:dir'.  If the filesystem name (local or remote)
17
# You can use anything (other than 'all') as set names
17
# contains spaces, then it should be enclosed in its entirety in double quotes.
18
#
18
# Multiple quoted filesystems included in a set should be space separated just
19
# Example:
19
# like unquoted filesystem.  The Perl '.' string concatenation operator can be
20
#  $set{'set1'} = "/home /usr";
20
# used to split excessively long lines.
21
#  $set{'set2'} = "/dir3 machine2:/dir4 machine3:/dir5";
21
#
22
# You can use anything (other than 'all') as set names.
23
#
24
# Examples:
25
#  $set{'set1'} = '/home /usr';
26
#  $set{'set2'} = '/dir3 machine2:/dir4 machine3:/dir5';
27
#  $set{'set3'} =
28
#      '"/mnt/winmachine1/Documents and Settings" ' .
29
#      '"/mnt/winmachine1/Program Files"';
22
#
30
#
23
# "-set all" will back up all defined sets. If you are doing a full backup
31
# "-set all" will back up all defined sets. If you are doing a full backup
24
# using tapes, each "set" will go onto a different tape and you will be
32
# using tapes, each "set" will go onto a different tape and you will be
25
# prompted for tape change in between.
33
# prompted for tape change in between.
26
#
34
#
27
$set{'backup'} = "/home";
35
$set{'backup'} = '/home';
28
36
29
# Subtree pruning
37
# Subtree pruning
30
# A space-separated list of directories to prune from each backup.
38
# A space-separated list of directories to prune from each backup.
Lines 42-48 Link Here
42
# start with "./".  To be helpful, FlexBackup packages each space-separated
50
# start with "./".  To be helpful, FlexBackup packages each space-separated
43
# prune directory as follows.  If you have a prune list like this
51
# prune directory as follows.  If you have a prune list like this
44
#
52
#
45
#     $prune{'/somedir'} = "one two three";
53
#     $prune{'/somedir'} = 'one two three';
46
#
54
#
47
# then, the constructed -regex argument to "find" looks like this
55
# then, the constructed -regex argument to "find" looks like this
48
#
56
#
Lines 54-84 Link Here
54
# terms that match the current base directory in the set you're backing
62
# terms that match the current base directory in the set you're backing
55
# up.  For example, if your backup set definition looks like this
63
# up.  For example, if your backup set definition looks like this
56
#
64
#
57
#     $set{'daily'} = "/home /root /var /usr";
65
#     $set{'daily'} = '/home /root /var /usr';
58
#
66
#
59
# and you want to do some exclusions in "/home" and "/var" (but not the other
67
# and you want to do some exclusions in "/home" and "/var" (but not the other
60
# directories), you must set up a prune list for those two directories 
68
# directories), you must set up a prune list for those two directories 
61
# separately.  For example, to exclude bert's and ernie's home directories plus
69
# separately.  For example, to exclude bert's and ernie's home directories plus
62
# /var/tmp, you would need the following:
70
# /var/tmp, you would need the following:
63
#
71
#
64
#     $prune{'/home'} = "bert ernie";
72
#     $prune{'/home'} = 'bert ernie';
65
#     $prune{'/var'}  = "tmp";
73
#     $prune{'/var'}  = 'tmp';
66
#
74
#
67
# In particular, combining these *does not* work.  For example, this
75
# In particular, combining these *does not* work.  For example, this
68
#
76
#
69
#     $prune{'/'} = "home/bert home/ernie var/tmp";
77
#     $prune{'/'} = 'home/bert home/ernie var/tmp';
70
#
78
#
71
# doesn't work, unless, of course, your backup set is backing up "/", 
79
# doesn't work, unless, of course, your backup set is backing up "/", 
72
# which our example is not.
80
# which our example is not.
73
#
81
#
82
# Like the $set configuration item, special handling is required for
83
# directories with spaces in them.  Double quotes should surround pruning
84
# targets but not the key.  Example:
85
#
86
#     $prune{'/mnt/winmachine1/Documents and Settings'} =
87
#         '"user1/Local Settings/Temp" user2';
88
#
74
# Many other complex and abstruse variations are possible.  Here's one 
89
# Many other complex and abstruse variations are possible.  Here's one 
75
# interesting corner case.  If you want to preserve a directory but none of its
90
# interesting corner case.  If you want to preserve a directory but none of its
76
# contents, you can do it.  Picking on ernie from our previous example, preserve
91
# contents, you can do it.  Picking on ernie from our previous example, preserve
77
# only his home directory:
92
# only his home directory:
78
#
93
#
79
#     $prune{'/home'} = "ernie/.*";
94
#     $prune{'/home'} = 'ernie/.*';
80
#
95
#
81
$prune{'/'} = "tmp proc";
96
$prune{'/'} = 'tmp proc';
82
97
83
# Compression
98
# Compression
84
$compress = 'gzip'; # one of false/gzip/bzip2/lzop/zip/compress/hardware/lzma
99
$compress = 'gzip'; # one of false/gzip/bzip2/lzop/zip/compress/hardware/lzma
(-)flexbackup.conf.5 (-10 / +39 lines)
Lines 24-48 Link Here
24
.TP
24
.TP
25
\fB$set{\fI'tag'\fR}\fR = \fI'/dir'\fR;
25
\fB$set{\fI'tag'\fR}\fR = \fI'/dir'\fR;
26
Configure backup \(dqsets\(dq. Not needed if \(dq-dir <dir>\(dq is used to
26
Configure backup \(dqsets\(dq. Not needed if \(dq-dir <dir>\(dq is used to
27
backup one tree at a time.  Each set is a simple space-separated list of
27
backup one tree at a time.
28
filesystems/directories. Remote filesystems should be denoted as
28
Each set is a simple space-separated list of filesystems/directories.
29
\(dqhost:directory\(dq.  You can use anything (other than \fI'all'\fR) as set
29
Remote filesystems should be denoted as \(dqhost:directory\(dq.
30
names. Using \(dq-set all\(dq will back up all defined sets. If you are doing
30
You can use anything (other than \fI'all'\fR) as set names.
31
a full backup using tapes, each \(dqset\(dq will go onto a different tape and
31
Using \(dq-set all\(dq will back up all defined sets.
32
you will be prompted for tape change in between. Examples:
32
If you are doing a full backup using tapes, each \(dqset\(dq will go onto a
33
different tape and you will be prompted for tape change in between.
34
Examples:
33
.RS
35
.RS
34
.PP
36
.PP
35
\fB$set{\fI'set1'\fI}\fR = \fI'/home /usr'\fR;
37
\fB$set{\fI'set1'\fI}\fR = \fI'/home /usr'\fR;
36
.br
38
.br
37
\fB$set{\fI'set2'\fI}\fR = \fI'/dir3 machine2:/dir4 machine3:/dir5'\fR;
39
\fB$set{\fI'set2'\fI}\fR = \fI'/dir3 machine2:/dir4 machine3:/dir5'\fR;
40
.br
41
.PP
42
Directories (local or remote) with spaces in their names should be enclosed in
43
their entirety in double quotes.
44
Multiple quoted directories included in a set should be space separated just
45
like unquoted directories.
46
The Perl '.' string concatenation operator can be used to split excessively
47
long sets.
48
Example:
49
.PP
50
\fB$set{\fI'set3'\fI}\fR = \fI
51
    '\(dq/mnt/winmachine1/Documents and Settings\(dq ' .
52
    '\(dq/mnt/winmachine1/Program Files\(dq';\fR
38
.RE
53
.RE
39
.TP
54
.TP
40
\fB$prune{\fI'/'\fR}\fR = \fI'tmp proc'\fR;
55
\fB$prune{\fI'/'\fR}\fR = \fI'tmp proc'\fR;
41
Configure subtree pruning. A space-separated list of directories to prune from
56
Configure subtree pruning. A space-separated list of directories to prune from
42
each backup. Key is a filesystem/directory or \(dqhost:directory\(dq spec as
57
each backup. Key is a filesystem/directory or \(dqhost:directory\(dq spec as
43
outlined above. Regular expressions allowed (not shell-type wildcards!). There
58
outlined above. Regular expressions allowed (not shell-type wildcards!).
44
is additional explanation (and a lot of examples) in the provided configuration
59
.RS
45
file.
60
.PP
61
Like the \fB$set\fR configuration item, special handling is required for
62
directories with spaces in them.  Double quotes should surround pruning targets
63
but not the key.  Example:
64
.PP
65
\fB$prune{\fI'/mnt/winmachine1/Documents and Settings'\fI}\fR = 
66
    \fI'\(dquser1/Local Settings/Temp\(dq user2'\fR;
67
.br
68
.PP
69
There are lots of examples and additional explanation in the provided sample
70
configuration file.
71
.RE
46
.TP
72
.TP
47
\fB$compress\fR = \fI'false|gzip|bzip2|lzop|zip|compress|hardware'\fR;
73
\fB$compress\fR = \fI'false|gzip|bzip2|lzop|zip|compress|hardware'\fR;
48
.TQ
74
.TQ
Lines 207-213 Link Here
207
.RS
233
.RS
208
.TP
234
.TP
209
If GNU \fBtar\fR is called \fB\(dqgtar\(dq\fR on your system:
235
If GNU \fBtar\fR is called \fB\(dqgtar\(dq\fR on your system:
210
\fB$path{'tar'} = 'gtar';
236
\fB$path{'tar'} = 'gtar';\fR
211
.TP
237
.TP
212
Or it can be used to \fB\(dqsudo\(dq\fR certain commands:
238
Or it can be used to \fB\(dqsudo\(dq\fR certain commands:
213
\fB$path{\fI'find'\fR}\fR = \fI'sudo find'\fR;
239
\fB$path{\fI'find'\fR}\fR = \fI'sudo find'\fR;
Lines 304-306 Link Here
304
Written by Edwin Huffstutler (edwinh@computer.org)
330
Written by Edwin Huffstutler (edwinh@computer.org)
305
.SH "SEE ALSO"
331
.SH "SEE ALSO"
306
\fBflexbackup\fR(1)
332
\fBflexbackup\fR(1)
333
.\" Local Variables:
334
.\" mode: nroff
335
.\" End:

Return to bug 184560