chiark / gitweb /
from lalonde
authorianmdlvl <ianmdlvl>
Sun, 11 May 2003 17:52:34 +0000 (17:52 +0000)
committerianmdlvl <ianmdlvl>
Sun, 11 May 2003 17:52:34 +0000 (17:52 +0000)
TODO
backup/backuplib.pl
backup/full
backup/increm
backup/iwjbackup.txt
debian/changelog

diff --git a/TODO b/TODO
index 9dc0150509d8747d86fe0b33945e08d469fcc5c5..bcf52f923afed2de6b390f5f1dad88e0c522cb9c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,8 +1,12 @@
 BACKUP
 ======
 
 BACKUP
 ======
 
+devices as well as mountpoints
+read/writebuffer buggy ?
+
 would be nice someday
 ---------------------
 would be nice someday
 ---------------------
+gz increms only
 replace loaded with idformat
 read/writebuffer setuid --mlock
 whatsthis no cloneandhack
 replace loaded with idformat
 read/writebuffer setuid --mlock
 whatsthis no cloneandhack
index 279cbd6ec0e782c2355df1693d841aa2794bf497..1163b5a0012be6b0ba157c55aa6ca4bc4a56e236 100644 (file)
@@ -23,6 +23,8 @@
 
 require IO::File;
 
 
 require IO::File;
 
+$nice='nice ' if !defined $nice;
+
 sub printdate () {
     print scalar(localtime),"\n";
 }
 sub printdate () {
     print scalar(localtime),"\n";
 }
@@ -141,7 +143,7 @@ sub readfsys ($) {
 # to be in $tf.
 sub parsefsys () {
     my ($dopts,$dopt);
 # to be in $tf.
 sub parsefsys () {
     my ($dopts,$dopt);
-    if ($tf =~ m#^(/\S*)\s+(\w+)([,0-9a-z]+)$#) {
+    if ($tf =~ m#^(/\S*)\s+(\w+)([,=0-9a-z]*)$#) {
         # Line of form '/file/system   dumptype[,options]'
        $atf= $1;
        $tm= $2;
         # Line of form '/file/system   dumptype[,options]'
        $atf= $1;
        $tm= $2;
@@ -150,7 +152,7 @@ sub parsefsys () {
        stat $atf or die "stat $atf: $!";
        -d _ or die "not a dir: $atf";
        $rstr= '';
        stat $atf or die "stat $atf: $!";
        -d _ or die "not a dir: $atf";
        $rstr= '';
-    } elsif ($tf =~ m#^(/\S*)\s+(\w+)([,0-9a-z]+)\s+(\w+)$#) {
+    } elsif ($tf =~ m#^(/\S*)\s+(\w+)([,=0-9a-z]*)\s+(\w+)$#) {
         # Line of form '/file/system dumptype[,options] prefix'
         # (used for remote backups)
        $atf= $1;
         # Line of form '/file/system dumptype[,options] prefix'
         # (used for remote backups)
        $atf= $1;
@@ -168,10 +170,20 @@ sub parsefsys () {
            $dopt{$dopt}= 'y';
        } elsif ($dopt =~ m/\=/ && grep { $` eq $_ } qw(gz)) {
            $dopt{$`}= $';
            $dopt{$dopt}= 'y';
        } elsif ($dopt =~ m/\=/ && grep { $` eq $_ } qw(gz)) {
            $dopt{$`}= $';
-       } else {
-           die "unknown option $dopt";
+       } elsif (length $dopt) {
+           die "unknown option $dopt (in $dopts $tf)";
        }
     }
        }
     }
+
+    if ($dopt{'gz'} eq 'y') {
+       $gz= '1';
+    } elsif ($dopt{'gz'} =~ m/^\d$/) {
+       $gz= $dopt{'gz'};
+    } elsif (defined $dopt{'gz'}) {
+       die "$tf bad gz";
+    } else {
+       $gz= 0;
+    }
 }
 
 sub openlog () {
 }
 
 sub openlog () {
index 784d302335e3c3653c6e484cab95fed8125281d4..ddd15ce215a2ff69e4c1ac4204b8c7efbec0bd3b 100755 (executable)
@@ -167,6 +167,7 @@ setstatus "FAILED during dump";
 sub closepipes () {
     close(DUMPOR); close(TEEOR); close(BUFOR); close(FINDOR);
     close(DUMPOW); close(TEEOW); close(BUFOW); close(FINDOW);
 sub closepipes () {
     close(DUMPOR); close(TEEOR); close(BUFOR); close(FINDOR);
     close(DUMPOW); close(TEEOW); close(BUFOW); close(FINDOW);
+    close(GZOR); close(GZOW);
 }
 
 # work out a find option string that will exclude the required files    
 }
 
 # work out a find option string that will exclude the required files    
@@ -182,32 +183,26 @@ foreach $exc (@excl) {
 # For each filesystem to be put on this tape:
 for $tf (@fsys) {
     printdate();
 # For each filesystem to be put on this tape:
 for $tf (@fsys) {
     printdate();
+    parsefsys();
+
     pipe(FINDOR,FINDOW) or die $!;
     pipe(DUMPOR,DUMPOW) or die $!;
     pipe(TEEOR,TEEOW) or die $!;
     pipe(FINDOR,FINDOW) or die $!;
     pipe(DUMPOR,DUMPOW) or die $!;
     pipe(TEEOR,TEEOW) or die $!;
+    pipe(BUFOR,BUFOW) or die $!;
+    
     $bufir='TEEOR';
     $bufir='TEEOR';
+    $ddcmd= "dd ibs=$softblocksizebytes obs=$blocksizebytes of=$ntape";
 
 
-    if ($dopt{'gz'} eq 'y') {
-       $gz= '3';
-    } elsif ($dopt{'gz'} =~ m/^\d$/) {
-       $gz= $dopt{'gz'};
-    } elsif (defined $dopt{'gz'}) {
-       die "$tf bad gz";
-    } else {
-       $gz= 0;
-    }
     if ($gz) {
        $bufir='GZOR';
        pipe(GZOR,GZOW) or die $!;
     if ($gz) {
        $bufir='GZOR';
        pipe(GZOR,GZOW) or die $!;
+       $ddcmd .= " conv=sync";
     }
     
     }
     
-    pipe(BUFOR,BUFOW) or die $!;
-    parsefsys();
-    
     # We can back up via dump or cpio or zafio
     # We can back up via dump or cpio or zafio
+    $dumpin= '</dev/null';
     if ($tm eq 'dump') {
        $dumpcmd= "dump 0bfu $softblocksizekb - $atf";
     if ($tm eq 'dump') {
        $dumpcmd= "dump 0bfu $softblocksizekb - $atf";
-       $dumpin= '</dev/null';
     } elsif ($tm eq 'cpio') {
        startprocess '</dev/null','>&FINDOW',$rstr."find $atf -xdev -noleaf -print0";
        $dumpcmd= "cpio -Hustar -o0C$softblocksizebytes";
     } elsif ($tm eq 'cpio') {
        startprocess '</dev/null','>&FINDOW',$rstr."find $atf -xdev -noleaf -print0";
        $dumpcmd= "cpio -Hustar -o0C$softblocksizebytes";
@@ -218,6 +213,9 @@ for $tf (@fsys) {
         # don't use verbose flag as this generates 2MB report emails :->
         $dumpcmd = "afio -b $softblocksizebytes -Zo -";
         $dumpin = '<&FINDOR';
         # don't use verbose flag as this generates 2MB report emails :->
         $dumpcmd = "afio -b $softblocksizebytes -Zo -";
         $dumpin = '<&FINDOR';
+    } elsif ($tm eq 'ntfsimage') {
+# fixme have to find device rather than mountpoint (atf is mountpoint)
+       $dumpcmd= "ntfsimage -vvf --dirty $atf";
     } else {
        die "unknown method $tm for $prefix:$atf\n";
     }
     } else {
        die "unknown method $tm for $prefix:$atf\n";
     }
@@ -225,16 +223,15 @@ for $tf (@fsys) {
     # to the exit status of all the commands in the pipeline.
     # It is roughly equivalent to:
     #    md5sum <p >>this-md5sums
     # to the exit status of all the commands in the pipeline.
     # It is roughly equivalent to:
     #    md5sum <p >>this-md5sums
-    #    dump <$dumpin | tee p | writebuffer | dd >/dev/null
-    startprocess '<p','>>this-md5sums','md5sum';
-    startprocess $dumpin,'>&DUMPOW',$rstr.$dumpcmd;
-    startprocess '<&DUMPOR','>&TEEOW','tee p';
+    #    dump <$dumpin | tee p [| gzip] | writebuffer | dd >/dev/null
+    startprocess '<p','>>this-md5sums',"$nice md5sum";
+    startprocess $dumpin,'>&DUMPOW',"$nice ".$rstr.$dumpcmd;
+    startprocess '<&DUMPOR','>&TEEOW',"$nice tee p";
     if ($gz) {
     if ($gz) {
-       startprocess '<&TEEOR','>&GZOW','gzip -v$gz';
+       startprocess '<&TEEOR','>&GZOW',"$nice gzip -v$gz";
     }
     }
-    startprocess "<&$bufir",'>&BUFOW','writebuffer';
-    startprocess '<&BUFOR','>/dev/null'
-       ,"dd ibs=$softblocksizebytes obs=$blocksizebytes of=$ntape";
+    startprocess "<&$bufir",'>&BUFOW',"$nasty writebuffer";
+    startprocess '<&BUFOR','>/dev/null',"$nasty $ddcmd";
     closepipes();
     endprocesses();
 }
     closepipes();
     endprocesses();
 }
@@ -251,9 +248,16 @@ system "mt -f $ntape fsf 1"; $? and die $?;
 open S,"this-md5sums" or die $!;
 for $tf (@fsys) {
     printdate();
 open S,"this-md5sums" or die $!;
 for $tf (@fsys) {
     printdate();
+    parsefsys();
     chomp($orgsum= <S>); $orgsum =~ s/\ +\-?$//;
     $orgsum =~ m/^[0-9a-fA-F]{32}$/i or die "orgsum \`$orgsum' ?";
     chomp($orgsum= <S>); $orgsum =~ s/\ +\-?$//;
     $orgsum =~ m/^[0-9a-fA-F]{32}$/i or die "orgsum \`$orgsum' ?";
-    chomp($csum= `dd if=$ntape ibs=$blocksizebytes | readbuffer | md5sum`);
+    $cmd= "$nasty dd if=$ntape ibs=$blocksizebytes";
+    $cmd .= " | $nasty readbuffer";
+    $cmd .= " | $nice gzip -vd" if $gz;
+    $cmd .= " | $nice md5sum";
+    print LOG "  $cmd\n" or die $!;
+    print "  $cmd\n" or die $!;
+    chomp($csum= `$cmd`);
     $csum =~ s/\ +\-?$//;
     $orgsum eq $csum or die "MISMATCH $tf $csum $orgsum\n";
     print "checksum ok $csum\t$tf\n" or die $!;
     $csum =~ s/\ +\-?$//;
     $orgsum eq $csum or die "MISMATCH $tf $csum $orgsum\n";
     print "checksum ok $csum\t$tf\n" or die $!;
index b3c1f7019d57e2dd42feeb1fea506ecab926c2c0..e3037e8068e10617447b20ddeb18e00f64d795dd 100755 (executable)
@@ -90,10 +90,23 @@ setstatus "PROBLEMS during incremental dump";
 
 for $tf (@fsys) {
 
 
 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 $!;
     pipe(DUMPOR,DUMPOW) or die $!;
     pipe(BUFOR,BUFOW) or die $!;
-    parsefsys();
-    if ($tm ne 'dump') {
+
+    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;
        print "Not dumping $atf ($prefix) - not \`dump'.\n" or die $!;
        print LOG "Not dumping $atf ($prefix) - not \`dump'.\n" or die $!;
        next;
@@ -101,10 +114,12 @@ for $tf (@fsys) {
     # Same trick as full uses to do a pipeline whilst keeping track
     # of all exit statuses:
     #   dump </dev/null | writebuffer | dd >/dev/null
     # 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 
     closepipes();
     endprocesses();
     # advance is a file counter, so it needs to be updated for each 
index 4ee23545b62140e47dceabf659a51495ee43683f..9c39ab740e44a0156f23d4a593512bf872cc8d7a 100644 (file)
@@ -54,18 +54,24 @@ In the fsys.* files:
    run things on a remote machine:
      prefix <prefix-name> <command-part>
   Other lines should be of the form
    run things on a remote machine:
      prefix <prefix-name> <command-part>
   Other lines should be of the form
-    <directory name>   <backup-type>
-  for local backups, or 
-    <directory name>   <backup-type>   <prefix-name>
+    [<device name>:]<directory name> <backup-type>[,<options>]
+  for local backups, or
+    [<device name>:]<directory name> <backup-type>[,<options>] <prefix-name>
   for remote backups.
 The file (including any included files) must end with the word 'end'
 on a line of its own.
 
 Valid values for <backup-type> are `cpio' (uses cpio to produce
 tar-format backups), `dump' (uses dump to dump entire filesystems;
   for remote backups.
 The file (including any included files) must end with the word 'end'
 on a line of its own.
 
 Valid values for <backup-type> are `cpio' (uses cpio to produce
 tar-format backups), `dump' (uses dump to dump entire filesystems;
-<directory name> should be a mount-point for this), and `zafio' (uses
-afio to compress each file as it is backed up).  Only `dump' type
-backups perform incremental backups.
+<directory name> should be a mount-point for this), `zafio' (uses afio
+to compress each file as it is backed up), and `ntfsimage' (for NTFS
+volumes, requires device name).  Only `dump' type backups perform
+incremental backups.
+
+<options> is a comma-separated list of <option> or <option>=<value>.
+The only currently support option is gz[=<compressionlevel>], to
+indicate that the whole stream should be compressed with gzip.  The
+compression level defaults to 1.
 
 expected-diffs is a config file to indicate which 
 filesystems should *not* be backed up. The scripts do a config
 
 expected-diffs is a config file to indicate which 
 filesystems should *not* be backed up. The scripts do a config
index 90b16ec2dd89f82dcb387ee8a1a728af01bab773..5f20d7a5ea13817bcce165ac7f3ad092e0571132 100644 (file)
@@ -1,8 +1,10 @@
 chiark-utils (3.0.3.99) unstable; urgency=low
 
   * chiark-backup: full dumps have tapedesc in TAPEID
 chiark-utils (3.0.3.99) unstable; urgency=low
 
   * chiark-backup: full dumps have tapedesc in TAPEID
+  * compression support (gz as a style option).
+  * $nice and $nasty in settings.pl.
 
 
- -- Ian Jackson <ian@davenant.greenend.org.uk>  Mon,  5 May 2003 17:09:40 +0100
+ --
 
 chiark-utils (3.0.3) unstable; urgency=low
 
 
 chiark-utils (3.0.3) unstable; urgency=low