Allow use of strftime chars in directories to backup

This commit is contained in:
Jamie Cameron
2014-08-01 22:32:09 -07:00
parent 4a121ab0ae
commit f3c8bd8cf1
5 changed files with 10 additions and 7 deletions

View File

@ -202,7 +202,7 @@ if ($_[0]->{'fs'} eq 'tar') {
$cmd .= " --rsh-command=$_[0]->{'rsh'}"
if ($_[0]->{'rsh'} && $_[0]->{'host'});
$cmd .= " $_[0]->{'extra'}" if ($_[0]->{'extra'});
$cmd .= " ".quotemeta($_[0]->{'dir'});
$cmd .= " ".quotemeta(&date_subs($_[0]->{'dir'}));
}
else {
# Construct ufs dump command
@ -216,7 +216,7 @@ else {
}
$cmd .= " -h 0" if ($_[0]->{'honour'});
$cmd .= " $_[0]->{'extra'}" if ($_[0]->{'extra'});
$cmd .= " ".quotemeta($_[0]->{'dir'});
$cmd .= " ".quotemeta(&date_subs($_[0]->{'dir'}));
}
&system_logged("sync");

View File

@ -140,7 +140,7 @@ $cmd .= " -o" if ($_[0]->{'overwrite'});
$cmd .= " -c \"$_[3] $_[0]->{'id'}\"" if ($_[3]);
$cmd .= " -E -F" if ($_[0]->{'erase'});
$cmd .= " $_[0]->{'extra'}" if ($_[0]->{'extra'});
$cmd .= " '$_[0]->{'dir'}'";
$cmd .= " '".&date_subs($_[0]->{'dir'})."'";
&system_logged("sync");
sleep(1);

View File

@ -348,6 +348,7 @@ local $tapecmd = $_[0]->{'multi'} && $_[0]->{'fs'} eq 'tar' ? $multi_cmd :
$_[3] && !$config{'nonewtape'} ? $newtape_cmd : $notape_cmd;
local @dirs = $_[0]->{'tabs'} ? split(/\t+/, $_[0]->{'dir'})
: split(/\s+/, $_[0]->{'dir'});
@dirs = map { &date_subs($_) } @dirs;
if ($_[0]->{'fs'} eq 'tar') {
# tar format backup
$cmd = "tar ".($_[0]->{'update'} ? "-u" : "-c")." ".$flag;

View File

@ -44,7 +44,7 @@ else {
# Validate and store inputs
if (&multiple_directory_support($in{'fs'})) {
$in{'dir'} =~ s/[\r\n]+/\t/g;
foreach $d (split(/\t+/, $in{'dir'})) {
foreach $d (split(/\t+/, &date_subs($in{'dir'}))) {
-d $d || &error($text{'save_edir'});
if ($in{'fs'} ne 'tar') {
$fs = &directory_filesystem($d);
@ -57,13 +57,14 @@ else {
$dump->{'tabs'} = 1; # tab used to split dirs
}
else {
-d $in{'dir'} || &error($text{'save_edir'});
$d = &date_subs($in{'dir'});
-d $d || &error($text{'save_edir'});
if ($in{'fs'} ne 'tar') {
$fs = &directory_filesystem($in{'dir'});
$fs = &directory_filesystem($d);
&same_filesystem($fs, $in{'fs'}) ||
&error($text{'save_efs'});
}
&can_edit_dir($in{'dir'}) || &error($text{'dump_ecannot3'});
&can_edit_dir($d) || &error($text{'dump_ecannot3'});
}
$dump->{'dir'} = $in{'dir'};
$dump->{'fs'} = $in{'fs'};

View File

@ -104,6 +104,7 @@ else {
$cmd .= " $_[0]->{'extra'}" if ($_[0]->{'extra'});
local @dirs = $_[0]->{'tabs'} ? split(/\t+/, $_[0]->{'dir'})
: split(/\s+/, $_[0]->{'dir'});
@dirs = map { &date_subs($_) } @dirs;
$cmd .= " ".join(" ", map { "'$_'" } @dirs);
&system_logged("sync");