chiark / gitweb /
@@ -1,3 +1,11 @@
authorianmdlvl <ianmdlvl>
Fri, 9 Nov 2001 21:12:19 +0000 (21:12 +0000)
committerianmdlvl <ianmdlvl>
Fri, 9 Nov 2001 21:12:19 +0000 (21:12 +0000)
+chiark-utils (2.1.0) experimental; urgency=low
+
+  * man pages for readbuffer, writebuffer from Richard Kettlewell.
+  * add info re last-tape and checkallused to iwjbackup.txt.
+  * new `backup-labeltape' utility.
+
+ --
+
 chiark-utils (2.0.0) experimental; urgency=low

   * Initial prepackaged release of chiark backup.

backup/Makefile
backup/backuplib.pl
backup/full
backup/iwjbackup.txt
backup/labeltape [new file with mode: 0755]
backup/readbuffer.1 [new file with mode: 0644]
backup/writebuffer.1 [new file with mode: 0644]
debian/changelog
debian/rules

index 3b559574b17cbc30c356abf09c6738a99e60030e..207766ffddbd5acef709f0d3b276e5be5fe711d1 100644 (file)
@@ -41,6 +41,8 @@ sharedir=$(prefix)/share/chiark-backup
 txtdocdir=$(prefix)/share/doc/chiark-backup
 exampledir=$(txtdocdir)/examples
 vardir=$(varlib)/chiark-backup
+mandir=${prefix}/man
+man1dir=${mandir}/man1
 
 INSTALL=               install -c
 INSTALL_SHARE=         $(INSTALL) -m 644 -o root -g root
@@ -49,7 +51,7 @@ INSTALL_PROGRAM=      $(INSTALL_SCRIPT) -s
 INSTALL_DIRECTORY=     $(INSTALL) -m 2755 -o root -g root -d
 
 CTARGETS=      readbuffer writebuffer
-BINSCRIPTS=    checkallused loaded driver takedown whatsthis
+BINSCRIPTS=    checkallused loaded driver takedown whatsthis labeltape
 SHARESCRIPTS=  bringup full increm
 SHAREFILES=    backuplib.pl
 
@@ -62,12 +64,14 @@ writebuffer:                                writebuffer.o rwbuffer.o
 readbuffer.o writebuffer.o rwbuffer.o: rwbuffer.h
 
 install:               all
-               $(INSTALL_DIRECTORY) $(confdir) $(bindir) $(sharedir) $(vardir)
+               $(INSTALL_DIRECTORY) $(confdir) $(bindir) $(sharedir) $(vardir) $(man1dir)
                $(INSTALL_PROGRAM) $(CTARGETS) $(bindir)
                set -e; for s in $(BINSCRIPTS); do \
                        $(INSTALL_SCRIPT) $$s $(bindir)/backup-$$s; done
                $(INSTALL_SHARE) $(SHAREFILES) $(sharedir)
                $(INSTALL_SCRIPT) $(SHARESCRIPTS) $(sharedir)
+               $(INSTALL) -m 644 readbuffer.1 ${man1dir}/readbuffer.1
+               $(INSTALL) -m 644 writebuffer.1 ${man1dir}/writebuffer.1
 
 install-docs:
                $(INSTALL_DIRECTORY) $(txtdocdir)
index ba1c50be01467958ded1c00873c1753870c5466a..8be8bff2cd91a889349377283ed119e6bde9884b 100644 (file)
@@ -51,6 +51,25 @@ sub startprocess ($$$) {
     exec $c; die "$c: $!";
 }
 
+sub readtapeid_raw () {
+    open T, ">>TAPEID" or die $!; close T;
+    unlink 'TAPEID' or die $!;
+    system "mt -f $tape rewind"; $? and die $?;
+    system "mt -f $tape setblk $blocksizebytes"; $? and die $?;
+    system "dd if=$tape bs=${blocksize}b count=10 ".
+          "| tar -b$blocksize -vvxf - TAPEID";
+}
+
+sub writetapeid ($) {
+    open T, ">TAPEID" or die $!;
+    print T "$_[0]\n" or die $!;
+    close T 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 $?;
+}
+
 sub endprocesses () {
     while (keys %processes) {
        $p= waitpid(-1,0) or die "wait: $!";
index 02b5b0c60d89b41ba85a068335cf1e59af39dd5f..0861537647647b6d3cbfdb450c8eee12d757cf4d 100755 (executable)
@@ -41,10 +41,8 @@ printdate();
 
 setstatus "FAILED reading TAPEID";
 # Try to read the tape ID from the tape into the file TAPEID
-unlink 'TAPEID';
-system "mt -f $tape rewind"; $? and die $?;
-system "mt -f $tape setblk $blocksizebytes"; $? and die $?;
-system "dd if=$tape bs=${blocksize}b count=10 | tar -b$blocksize -vvxf - TAPEID";
+
+readtapeid_raw();
 
 setstatus "FAILED during startup";
 
@@ -132,12 +130,8 @@ print LOG "$doing:\n" or die $!;
 
 setstatus "FAILED writing tape ID";
 # First write the tape ID to this tape.
-open T, ">TAPEID" or die $!;
-print T "$tapeid\n" or die $!;
-close T 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);
 
 unlink 'this-md5sums';
 
index 91c904c87ea69eb70aeb602feb4fcb245fc51285..4ee23545b62140e47dceabf659a51495ee43683f 100644 (file)
@@ -96,6 +96,10 @@ Useful scripts (all in /usr/bin):
 backup-checkallused: this only does a check of the configuration
 files.  It should give a cryptic summary of the configuration and
 print 'configuration ok'. If not, fix your config files :->
+You have to create the file /var/lib/chiark-backup/last-tape
+containing the id of a tape; this helps backup-checkallused know where
+to start iterating over tapes.  Any tapeid will do.  (But don't make
+it the same as the one you want to back up to first.)
 
 backup-loaded: this tells the scripts that a currently unlabelled tape
 should be treated as tape X: eg:
diff --git a/backup/labeltape b/backup/labeltape
new file mode 100755 (executable)
index 0000000..98961af
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+
+use POSIX;
+
+$etc= '/etc/chiark-backup';
+require "$etc/settings.pl";
+require 'backuplib.pl';
+
+while ($ARGV[0] =~ m/^-/) {
+    $_= shift @ARGV;
+    last if m/^\-$/;
+    s/^\-//;
+    while (length) {
+       if (s/^f//) {
+           $force=1;
+       } else {
+           die "$0: unknown option -$_\n";
+       }
+    }
+}
+
+@ARGV==1 or die "$0: need 1 arg, new TAPEID";
+($newid)= @ARGV;
+
+readtapeid_raw();
+
+if (!open T,'TAPEID') {
+    $!==&ENOENT or die $!;
+} else {
+    chomp($oldid= <T>);
+    close T or die $!;
+    print "Tape is currently labelled \`$oldid'\n" or die $!;
+    die "$0: use -f to force relabelling\n" unless $force;
+}
+
+open T,'>TAPEID' or die $!;
+print T "$newid\n" or die $!;
+close T or die $!;
+
+writetapeid($newid);
+
+print "Labelled tape \`$newid'\n" or die $!;
+exit 0;
diff --git a/backup/readbuffer.1 b/backup/readbuffer.1
new file mode 100644 (file)
index 0000000..361faea
--- /dev/null
@@ -0,0 +1,24 @@
+.TH readbuffer 1 2001-10-21 chiark-backup
+.SH NAME
+readbuffer \- read input from devices which don't like constant stopping and starting
+.SH SYNOPSIS
+.B readbuffer
+.RB [ --mlock ]
+.RI [ size ]
+.SH DESCRIPTION
+.B readbuffer
+reads data on standard input and writes it to standard output.  It
+will internally buffer up to \fIsize\fR megabytes of data, and will
+only read more data when the buffer is at least 75% empty.
+.PP
+It is intended for use in situations where many small
+reads are undesirable for performance reasons, e.g. tape drives.
+.SH OPTIONS
+.TP
+.B --mlock
+Calls
+.BR mlock (2)
+to lock the buffer into memory.
+.SH "SEE ALSO"
+.BR writebuffer (1),
+.BR mlock (2)
diff --git a/backup/writebuffer.1 b/backup/writebuffer.1
new file mode 100644 (file)
index 0000000..796ba93
--- /dev/null
@@ -0,0 +1,25 @@
+.TH writebuffer 1 2001-10-21 chiark-backup
+.SH NAME
+writebuffer \- write output to devices which don't like constant stopping and starting
+.SH SYNOPSIS
+.B writebuffer
+.RB [ --mlock ]
+.RI [ size ]
+.SH DESCRIPTION
+.B writebuffer
+reads data on standard input and writes it to standard output.  It
+will buffer internally up to \fIsize\fR megabytes and will only write
+data when the buffer is at least 75% full or when there is no more
+input to fill the buffer.
+.PP
+It is intended for use in situations where many small writes are
+undesirable for performance reasons, e.g. tape drives.
+.SH OPTIONS
+.TP
+.B --mlock
+Calls
+.BR mlock (2)
+to lock the buffer into memory.
+.SH "SEE ALSO"
+.BR readbuffer (1),
+.BR mlock (2)
index 8e65459c5dec0bfdac3ea025239ead2be64daa48..3d7ad9c6a710855679eacdf66da9d5446cea29ba 100644 (file)
@@ -1,3 +1,11 @@
+chiark-utils (2.1.0) experimental; urgency=low
+
+  * man pages for readbuffer, writebuffer from Richard Kettlewell.
+  * add info re last-tape and checkallused to iwjbackup.txt.
+  * new `backup-labeltape' utility.
+
+ --
+
 chiark-utils (2.0.0) experimental; urgency=low
   
   * Initial prepackaged release of chiark backup.
index 8265a3d9211be22e3121703d7b8c60d48b498698..8cc2a66911d376f1160e741e3d8683d07969dd98 100755 (executable)
@@ -40,11 +40,16 @@ binary-prep:
        $(MAKE) -C backup install install-docs install-examples \
                prefix=$t/chiark-backup/usr \
                etcdir=$t/chiark-backup/etc \
-               varlib=$t/chiark-backup/var/lib
+               varlib=$t/chiark-backup/var/lib \
+               mandir=$t/chiark-backup/usr/share/man
        #
        install -d $t/chiark-rwbuffer/usr/bin
+       install -d $t/chiark-rwbuffer/usr/share/man/man1
        cd $t/chiark-backup/usr/bin && \
                mv readbuffer writebuffer $t/chiark-rwbuffer/usr/bin
+       cd $t/chiark-backup/usr/share/man/man1 && \
+               mv readbuffer.1 writebuffer.1 $t/chiark-rwbuffer/usr/share/man/man1
+       gzip -9f $t/*/usr/share/man/man*/*
 
 binary-hook-chiark-backup:
 binary-hook-chiark-rwbuffer: