chiark / gitweb /
@@ -6,8 +6,11 @@
[chiark-utils.git] / backup / increm
index fc20b3a32b85e6ef49114cabdd337d2c8db70099..bc058f7f7ffe0f44c1bf0300eb92696448f5382b 100755 (executable)
@@ -28,7 +28,7 @@
 # includes ID and function).
 
 BEGIN {
-    $etc= '/etc/backup';
+    $etc= '/etc/chiark-backup';
     require "$etc/settings.pl";
     require 'backuplib.pl';
 }
@@ -67,14 +67,10 @@ $advance =~ m/^\d+$/ or die "$advance ?";
 # it invoked us, so no need to read the existing TAPEID record first.)
 system "mt -f $ntape rewind"; $? and die $?;
 if ($advance == 1) {
-    open TI,">TAPEID" or die $!;
-    print TI "$tapeid\n$tapedesc\n" or die $!;
-    close TI or die $!;
-
-    system "tar -b$blocksize -vvcf TAPEID.tar TAPEID"; $? and die $?;
-    system "dd if=TAPEID.tar of=$ntape bs=${blocksize}b count=10"; $? and die $?;
+    writetapeid($tapeid,$tapedesc);
 } else {
     system "mt -f $ntape fsf $advance"; $? and die $?;
+    $currenttapefilenumber= $advance+1;
 }
 
 # Get a list of all filesystems
@@ -90,21 +86,40 @@ setstatus "PROBLEMS during incremental dump";
 
 for $tf (@fsys) {
 
+    parsefsys();
+    
+    $bufir='DUMPOR';
+    $ddcmd= "$nasty dd ibs=$softblocksizebytes obs=$blocksizebytes of=$ntape";
+
     pipe(DUMPOR,DUMPOW) or die $!;
     pipe(BUFOR,BUFOW) or die $!;
-    parsefsys();
-    if ($tm ne 'dump') {
+
+    $gz= $gzi if length $gzi;
+    if ($gz) {
+       $bufir='GZOR';
+       pipe(GZOR,GZOW) or die $!;
+       $ddcmd .= " conv=sync";
+    }
+
+    if ($tm eq 'dump') {
+       $dumpcmd= "dump 1bfu $softblocksizekb - $atf";
+    } else {
        print "Not dumping $atf ($prefix) - not \`dump'.\n" or die $!;
        print LOG "Not dumping $atf ($prefix) - not \`dump'.\n" or die $!;
        next;
     }
+
+    nexttapefile("inc $prefix:$atf");
+    
     # Same trick as full uses to do a pipeline whilst keeping track
     # of all exit statuses:
     #   dump </dev/null | writebuffer | dd >/dev/null
-    startprocess '</dev/null','>&DUMPOW',$rstr."dump 1bfu $softblocksizekb - $atf";
-    startprocess '<&DUMPOR','>&BUFOW','writebuffer';
-    startprocess '<&BUFOR','>/dev/null'
-       ,"dd ibs=$softblocksizebytes obs=$blocksizebytes of=$ntape";
+    startprocess '</dev/null','>&DUMPOW',"$nice ".$rstr.$dumpcmd;
+    if ($gz) {
+       startprocess '<&DUMPOR','>&GZOW',"$nice gzip -v$gz";
+    }
+    startprocess "<&$bufir",'>&BUFOW',"$nasty writebuffer";
+    startprocess '<&BUFOR','>/dev/null',"$nasty $ddcmd";
     closepipes();
     endprocesses();
     # advance is a file counter, so it needs to be updated for each