|
|
$cmd .= "$::unz"; | $cmd .= "$::unz"; |
} | } |
$cmd .= "("; | $cmd .= "("; |
$cmd .= "mkdir -p $::device ; "; |
$cmd .= "mkdir -p \"$::device\" ; "; |
$cmd .= "cd $::device ; "; |
$cmd .= "cd \"$::device\" ; "; |
$cmd .= "$::path{cpio} -i "; | $cmd .= "$::path{cpio} -i "; |
$cmd .= "-m "; | $cmd .= "-m "; |
$cmd .= "-d "; | $cmd .= "-d "; |
|
|
| |
# Have to take leading './' off to make rsync's include/exclude work right | # Have to take leading './' off to make rsync's include/exclude work right |
$cmd .= " | $::path{sed} -e \"s/\\.\\///g\" | "; | $cmd .= " | $::path{sed} -e \"s/\\.\\///g\" | "; |
|
|
$cmd .= "$::path{rsync} "; | $cmd .= "$::path{rsync} "; |
$cmd .= "--include-from=- --exclude=* "; |
$cmd .= "--files-from=- "; |
$cmd .= "--archive "; | $cmd .= "--archive "; |
$cmd .= "$::rsync_verb_flag "; | $cmd .= "$::rsync_verb_flag "; |
$cmd .= "--delete --delete-excluded "; | $cmd .= "--delete --delete-excluded "; |
|
|
$cmd .= "$remote:"; | $cmd .= "$remote:"; |
} | } |
} | } |
$cmd .= "$dir/ $::device"; |
$cmd .= "\"$dir/\" \"$::device\""; |
| |
push(@cmds, $cmd); | push(@cmds, $cmd); |
| |
|
|
my $tmpfile = "$cfg::tmpdir/ar.$PROCESS_ID"; | my $tmpfile = "$cfg::tmpdir/ar.$PROCESS_ID"; |
my $remove = ''; | my $remove = ''; |
| |
&log("| NOTE: ar archives will not descend directories"); |
&log("| NOTE: ar archives will not recurse into subdirectories,"); |
|
&log("| which makes them inappropriate for most backups."); |
|
&log("| Be sure this is what you want."); |
| |
if (defined($remote) and ($level != 0)) { | if (defined($remote) and ($level != 0)) { |
my $time = &get_last_date($label, $level, 'numeric'); | my $time = &get_last_date($label, $level, 'numeric'); |
|
|
$cmd = "cd \"$dir\" && "; | $cmd = "cd \"$dir\" && "; |
$cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote, '-maxdepth 1 ! -type d'); | $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote, '-maxdepth 1 ! -type d'); |
$cmd .= "> $filelist; "; | $cmd .= "> $filelist; "; |
|
# Escape any spaces in filenames. |
|
$cmd .= "$::path{sed} -i -e 's/ /\\\\ /g' $filelist; "; |
| |
$cmd .= "$::path{ar} rc"; | $cmd .= "$::path{ar} rc"; |
$cmd .= "$::ar_verb_flag "; | $cmd .= "$::ar_verb_flag "; |
$cmd .= "$tmpfile "; | $cmd .= "$tmpfile "; |
$cmd .= "`$::path{cat} $filelist`"; |
$cmd .= "\@$filelist "; |
$cmd .= "; $::path{cat} $tmpfile $::z"; | $cmd .= "; $::path{cat} $tmpfile $::z"; |
| |
# Buffer both sides if remote | # Buffer both sides if remote |
|
|
| |
$cmd = "cd \"$dir\" && "; | $cmd = "cd \"$dir\" && "; |
$cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote); | $cmd .= &file_list_cmd( $dir, $stamp, 'newline', $level, $remote); |
$cmd .= "> $filelist; "; |
$cmd .= " | $::path{lha} a"; |
|
|
$cmd .= "$::path{lha} a"; |
|
$cmd .= "$::lha_verb_flag "; | $cmd .= "$::lha_verb_flag "; |
$cmd .= "$tmpfile "; | $cmd .= "$tmpfile "; |
$cmd .= "`$::path{cat} $filelist`"; |
|
$cmd .= "; $::path{cat} $tmpfile $::z"; | $cmd .= "; $::path{cat} $tmpfile $::z"; |
| |
# Buffer both sides if remote | # Buffer both sides if remote |
|
|
$::path{'dd'} = &checkinpath('dd'); | $::path{'dd'} = &checkinpath('dd'); |
$::path{'printf'} = &checkinpath('printf'); | $::path{'printf'} = &checkinpath('printf'); |
$::path{'mkdir'} = &checkinpath('mkdir'); | $::path{'mkdir'} = &checkinpath('mkdir'); |
|
$::path{'sed'} = &checkinpath('sed'); |
| |
push(@::remoteprogs,($::path{'touch'},$::path{'rm'},$::path{'find'},$::path{'printf'},$::path{'mkdir'})); | push(@::remoteprogs,($::path{'touch'},$::path{'rm'},$::path{'find'},$::path{'printf'},$::path{'mkdir'})); |
| |
|
|
$rex .= '\)"'; | $rex .= '\)"'; |
} | } |
# Show what the darn thing is constructing for prune expressions. | # Show what the darn thing is constructing for prune expressions. |
&log("| \"find\" regex for pruning is:"); |
my $temp = $rex; |
&log("| $rex"); |
$temp =~ s/\\([()|])/$1/g; |
&line(); |
&log("| \"find\" regex for pruning (shell escaping omitted for clarity) is:"); |
|
&log("| $temp"); |
$cmd .= '-regex ' . $rex . ' -prune -o '; | $cmd .= '-regex ' . $rex . ' -prune -o '; |
} else { | } else { |
# Show what the darn thing is constructing for prune expressions. | # Show what the darn thing is constructing for prune expressions. |
|
|
# don't have permissions on and are running as non-root) | # don't have permissions on and are running as non-root) |
$cmd .= "-depth "; | $cmd .= "-depth "; |
} | } |
|
&line(); |
| |
$cmd .= "$::mountpoint_flag "; | $cmd .= "$::mountpoint_flag "; |
$cmd .= "! -type s "; | $cmd .= "! -type s "; |
|
|
print $::msg "| Checking '$cfg::buffer' on this machine... "; | print $::msg "| Checking '$cfg::buffer' on this machine... "; |
$pipecmd = "sh $tmp_script "; | $pipecmd = "sh $tmp_script "; |
} else { | } else { |
|
$pipecmd = |
|
"$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; " . |
|
"cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; " . |
|
"sh $tmp_script; rm -rf $cfg::tmpdir')"; |
print $::msg "| Checking '$cfg::buffer' on host $host... "; | print $::msg "| Checking '$cfg::buffer' on host $host... "; |
$pipecmd = "$::remoteshell $host '$::path{mkdir} -p $cfg::tmpdir'; cat $tmp_script | ($::remoteshell $host 'cat > $tmp_script; sh $tmp_script; rm -rf $cfg::tmpdir')"; |
|
} | } |
| |
if (!defined($::debug)) { | if (!defined($::debug)) { |
|
|
open(PIPE,"$pipecmd |") || die; | open(PIPE,"$pipecmd |") || die; |
| |
$explicit_success = 0; | $explicit_success = 0; |