chiark / gitweb /
show mt runes; bugfixes from lalonde
authorianmdlvl <ianmdlvl>
Sun, 11 May 2003 21:39:59 +0000 (21:39 +0000)
committerianmdlvl <ianmdlvl>
Sun, 11 May 2003 21:39:59 +0000 (21:39 +0000)
backup/backuplib.pl
backup/full
backup/increm
debian/changelog

index 783b14d50bf6d298ef0b62400f7ebc53a6793d8b..174dc812c9678320c53328e31c0ea0d50a05cfd0 100644 (file)
@@ -54,7 +54,7 @@ sub startprocess ($$$) {
 }
 
 sub rewind_raw () {
-    system "mt -f $tape rewind"; $? and die $?;
+    runsystem("mt -f $tape rewind");
 }
 
 sub readtapeid_raw () {
@@ -66,6 +66,12 @@ sub readtapeid_raw () {
           "| tar -b$blocksize -vvxf - TAPEID";
 }
 
+sub runsystem ($) {
+    pboth("    $_[0]\n");
+    system $_[0];
+    $? and die $?;
+}
+
 sub pboth ($) {
     my ($str) = @_;
     print LOG $str or die $!;
@@ -76,7 +82,7 @@ sub nexttapefile ($) {
     my ($what) = @_;
     $currenttapefilenumber++;
     $currenttapefilename= $what;
-    pboth(sprintf "writing tape file #%d (mt fsf %d): %s",
+    pboth(sprintf "writing tape file #%d (mt fsf %d): %s\n",
          $currenttapefilenumber, $currenttapefilenumber-1, $what);
 }
 
index e23890d9dbb605b9ad69e664559cedb9abaaa84e..2f630eb1660bbf561df8c6d02c4b2b91eb20e487 100755 (executable)
@@ -45,6 +45,8 @@ while (@ARGV) {
 # checkallused checks that all the filesystems mounted are in fact
 # dumped in both full and incremental dumps.
 
+openlog();
+
 if (!$nocheck) {
     setstatus "FAILED configuration check";
     print "Configuration check ...\n" or die $!;
@@ -140,14 +142,13 @@ if ($incremental) {
 
 # Read the filesystem group definition (file fsys.nnn)
 readfsys("$fsys");
-openlog();
 
 $doing= "dump of $fsys to tape $tapedesc in drive $tape";
 print LOG "$doing:\n" or die $!;
 
 if (!$noreten) {
     setstatus "FAILED retensioning";
-    system "mt -f $tape reten"; $? and die $?;
+    runsystem("mt -f $tape reten");
 }
 
 setstatus "FAILED writing tape ID";
@@ -246,8 +247,8 @@ for $tf (@fsys) {
     close DDERR;
     m/\n(\d+)\+0 records out\n/ or die ">$dderr< ?";
     push @tapefilesizes, [ $1, $currenttapefilename ];
-    $totalrecords++;
-    pboth("total blocks written so far: $totalrecords");
+    $totalrecords += $1;
+    pboth("total blocks written so far: $totalrecords\n");
 }
 
 # The backup should now be complete; verify it
@@ -255,8 +256,8 @@ for $tf (@fsys) {
 setstatus "FAILED during check";
 
 # Rewind the tape and skip the TAPEID record
-system "mt -f $tape rewind"; $? and die $?;
-system "mt -f $ntape fsf 1"; $? and die $?;
+runsystem("mt -f $tape rewind");
+runsystem("mt -f $ntape fsf 1");
 
 # Check the md5sums match for each filesystem on the tape
 open S,"this-md5sums" or die $!;
@@ -277,16 +278,25 @@ for $tf (@fsys) {
     print LOG "checksum ok $csum\t$tf\n" or die $!;
 }
 printdate();
-system "mt -f $tape rewind"; $? and die $?;
+runsystem("mt -f $tape rewind");
 
 setstatus "FAILED during cleanup";
 
-pboth("summary:");
+$summary= '';
 foreach $tfs (@tapefilesizes) {
-    pboth(sprintf "    %10d blocks for %s\n", $tfs->[0], $tfs->[1]);
+    $summary .= sprintf "    %10d blocks for %s\n", $tfs->[0], $tfs->[1]
 }
-pboth(sprintf "    %10d blocks total (of %d bytes) plus TAPEID and headers\n",
-      $totalrecords, $blocksizebytes);
+$summary .=
+    sprintf "    %10d blocks total (of %d bytes) plus TAPEID and headers\n",
+    $totalrecords, $blocksizebytes;
+
+pboth("size-summary:\n");
+pboth($summary);
+
+open SS, ">size-summary..new" or die $!;
+print SS $summary or die $!;
+close SS or die $!;
+rename 'size-summary..new',"size-summary.$fsys" or die $!;
 
 # Write to some status files to indicate what the backup system
 # ought to do when next invoked.
index bc058f7f7ffe0f44c1bf0300eb92696448f5382b..f2cb7b4814b30e8b4ffaddfe9e6f1a7272c552b1 100755 (executable)
@@ -61,22 +61,22 @@ close A or die $!;
 # better be a decimal number
 $advance =~ m/^\d+$/ or die "$advance ?";
 
+# Get a list of all filesystems
+readfsys('all');
+openlog();
+
 # Rewind the tape and if we are the first incremental on the tape then
 # write the TAPEID record, otherwise skip forward to the correct point.
 # (full will already have checked that this is the right tape before
 # it invoked us, so no need to read the existing TAPEID record first.)
-system "mt -f $ntape rewind"; $? and die $?;
+runsystem("mt -f $ntape rewind");
 if ($advance == 1) {
     writetapeid($tapeid,$tapedesc);
 } else {
-    system "mt -f $ntape fsf $advance"; $? and die $?;
-    $currenttapefilenumber= $advance+1;
+    runsystem("mt -f $ntape fsf $advance");
+    $currenttapefilenumber= $advance;
 }
 
-# Get a list of all filesystems
-readfsys('all');
-openlog();
-
 sub closepipes () {
     close(DUMPOR); close(BUFOR);
     close(DUMPOW); close(BUFOW);
@@ -128,7 +128,7 @@ for $tf (@fsys) {
 }
 
 # Rewind the tape, and increment the counter of incremental backups.
-system "mt -f $tape rewind"; $? and die $?;
+runsystem("mt -f $tape rewind");
 open IAN,">increm-advance.new" or die $!;
 print IAN "$advance\n" or die $!;
 close IAN or die $!;
index aad37c259d8c2ce1436d216576a9adebf1cdc1cf..56977ab38b0799f19e8acbe427e8cc8c24a4a444 100644 (file)
@@ -9,8 +9,9 @@ chiark-utils (3.0.3.99) unstable; urgency=low
   * A little less clone-and-hack.
   * Count and display on-tape file numbers.
   * Count output blocks for each tape file and in total.
+  * Show mt runes when we execute them.
 
- -- Ian Jackson <ian@davenant.greenend.org.uk>  Sun, 11 May 2003 21:11:49 +0100
+ --
 
 chiark-utils (3.0.3) unstable; urgency=low