X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=blobdiff_plain;f=backup%2Fbackuplib.pl;h=783b14d50bf6d298ef0b62400f7ebc53a6793d8b;hp=50cc70a745f9aa070ed6778f12e3455c3df1303a;hb=314a202a6f4e0a120fd982ad0398cdf507d6219d;hpb=e471eed92bf574a3eb02099572cd6ee6d37bebc3 diff --git a/backup/backuplib.pl b/backup/backuplib.pl index 50cc70a..783b14d 100644 --- a/backup/backuplib.pl +++ b/backup/backuplib.pl @@ -66,11 +66,28 @@ sub readtapeid_raw () { "| tar -b$blocksize -vvxf - TAPEID"; } +sub pboth ($) { + my ($str) = @_; + print LOG $str or die $!; + print $str or die $!; +} + +sub nexttapefile ($) { + my ($what) = @_; + $currenttapefilenumber++; + $currenttapefilename= $what; + pboth(sprintf "writing tape file #%d (mt fsf %d): %s", + $currenttapefilenumber, $currenttapefilenumber-1, $what); +} + sub writetapeid ($$) { open T, ">TAPEID" or die $!; print T "$_[0]\n$_[1]\n" or die $!; close T or die $!; + $currenttapefilenumber= 0; + nexttapefile('TAPEID'); + system "tar -b$blocksize -vvcf TAPEID.tar TAPEID"; $? and die $?; system "dd if=TAPEID.tar of=$ntape bs=${blocksize}b count=10"; $? and die $?; @@ -84,8 +101,7 @@ sub endprocesses () { delete $processes{$p}; $? && die "error: command gave code $?: $c\n"; } - print LOG " ok\n" or die $!; - print " ok\n" or die $!; + pboth(" ok\n"); } sub killprocesses {