From: ianmdlvl Date: Sun, 7 Oct 2001 18:09:42 +0000 (+0000) Subject: Clean up a bit and add copyright notices. X-Git-Tag: tag-2001-10-07-before-debianise-reorg~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=commitdiff_plain;h=d906fbd72072c6953922e0627bbcf3d4c62ce7c0 Clean up a bit and add copyright notices. --- diff --git a/backup/Makefile b/backup/Makefile index 1315c88..59a3c11 100644 --- a/backup/Makefile +++ b/backup/Makefile @@ -1,2 +1,25 @@ +# Makefile +# simple make settings +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + CC=gcc CFLAGS=-Wall -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -O2 -g diff --git a/backup/Makefile-etc b/backup/Makefile-etc index 89bee04..62b0b2f 100644 --- a/backup/Makefile-etc +++ b/backup/Makefile-etc @@ -1,3 +1,25 @@ +# Makefile-etc +# for putting in /etc/backup to make fsys.* from ifsys.* +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. all: fsys.pt0 fsys.pt1 fsys.pt2 fsys.all @@ -6,3 +28,4 @@ fsys.pt%: ifsys.prefixes ifsys.pt% ifsys.end fsys.all: ifsys.prefixes ifsys.pt0 ifsys.pt1 ifsys.pt2 ifsys.end cat $^ >$@.new && mv -f $@.new $@ + diff --git a/backup/backuplib.pl b/backup/backuplib.pl index 9acd7a0..37b3d79 100644 --- a/backup/backuplib.pl +++ b/backup/backuplib.pl @@ -1,6 +1,25 @@ +# backuplib.pl +# core common routines # - -# Assorted useful functions used by the backup scripts. +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. sub printdate () { print scalar(localtime),"\n"; diff --git a/backup/bringup b/backup/bringup index ffca871..ff6107d 100755 --- a/backup/bringup +++ b/backup/bringup @@ -1,8 +1,32 @@ #!/bin/sh +# bringup +# script for going back to defaultrunlevel +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # Very simple: extract the default runlevel from /etc/inittab # and change to it with telinit. runlevel=`sed -ne '/^id:/ s/.*:\([0-9]\):.*/\1/p' /etc/inittab` telinit $runlevel + # This switches to virtual console 11, but I don't think I want that -- PMM #chvt 11 diff --git a/backup/checkallused b/backup/checkallused index 8fb4468..ab2dcd6 100755 --- a/backup/checkallused +++ b/backup/checkallused @@ -1,8 +1,29 @@ #!/usr/bin/perl +# checkallused +# check that the configuration is sane and backs up everything it should +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Read all the configuration files and check that all filesystems -# are either backed up in both full and incremental dumps or -# listed as exceptions. +# All filesystems must either be backed up in both full and +# incremental dumps or listed as exceptions. BEGIN { $etc= '/etc/backup'; diff --git a/backup/driver b/backup/driver index 3cede61..c143bd8 100755 --- a/backup/driver +++ b/backup/driver @@ -1,5 +1,26 @@ #!/bin/sh -# This is the driver script that actually runs backups. +# driver +# entry point for inittab (or perhaps cron) to run the backups. +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cd /var/local/backup PATH=/usr/local/lib/backup:$PATH export PATH diff --git a/backup/full b/backup/full index 5e6d23e..dddb343 100755 --- a/backup/full +++ b/backup/full @@ -1,4 +1,26 @@ #!/usr/bin/perl +# full +# Main backup script - does a full dump or execs increm. Do NOT run directly! +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. BEGIN { $etc= '/etc/backup'; diff --git a/backup/increm b/backup/increm index 63d56d4..fc20b3a 100755 --- a/backup/increm +++ b/backup/increm @@ -1,10 +1,31 @@ #!/usr/bin/perl - -# Do an incremental backup. We are invoked by full if the tape -# description file says that it is for an incremental backup. -# We expect two commandline argument which is the ID string -# of the tape to use, and the description (which includes ID -# and function). +# increm +# Do an incremental backup; ONLY for invocation by full ! +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# We are invoked by full if the tape description file says that it is +# for an incremental backup. We expect two commandline argument which +# is the ID string of the tape to use, and the description (which +# includes ID and function). BEGIN { $etc= '/etc/backup'; diff --git a/backup/iwjbackup.txt b/backup/iwjbackup.txt index 1424a3a..9866f09 100644 --- a/backup/iwjbackup.txt +++ b/backup/iwjbackup.txt @@ -5,6 +5,30 @@ source is the sources, as always :-> WARNING - this file is out of date ! +# iwjbackup.txt +# Documentation file +# +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + The three tarfiles in this directory should go in the following places (the paths can probably be configured/hacked, but this is diff --git a/backup/junk b/backup/junk deleted file mode 100644 index 92769e4..0000000 --- a/backup/junk +++ /dev/null @@ -1,34 +0,0 @@ - - -timestamp () { - echo "Checking timestamp of last full dump of $1;" - if ! test lfull.$which -ot lfull.$1 - then - which=$1 - fi -} - -ok=1 - -for dsk in `cat allincs` -do - which='.' - . inc.$dsk - if test -f "lfull.$which" - then - echo "Using timestamp of last full dump of $which." - else - echo >&2 "No full dump of $which done yet." - exit 1 - fi - - since="`cat lfull.$which`" - doing="incremental of $filesys to $device - files changed since dump of $which at `cat lfull.$which`" - - rm -f log - (umask 007; >log) - - echo Doing "$doing" ... - - diff --git a/backup/loaded b/backup/loaded index 7a8335f..69adcb4 100755 --- a/backup/loaded +++ b/backup/loaded @@ -1,6 +1,26 @@ #!/bin/sh +# loaded +# Entry point for sysadmin to state that we've loaded a tape # -# State that we have loaded a tape +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. set -e cd /var/local/backup diff --git a/backup/old-increm b/backup/old-increm deleted file mode 100755 index b036b89..0000000 --- a/backup/old-increm +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -set -e -false -dir=/var/local/backup -device=/dev/sda4 -blocksize=2048 -filesystems=all - -cd $dir -PATH=/usr/local/lib/backup:$PATH export PATH - -echo "FAILED during startup of incremental" >this-status - -timestamp='.' -for tsfs in `cat all-fsys-n` -do - echo "Checking timestamp of last full dump of $tsfs;" - if ! test "lfull.$timestamp" -ot "lfull.$tsfs" - then - timestamp="$tsfs" - fi -done - -if test -f "lfull.$timestamp" -then - echo "Using timestamp of last full dump of $timestamp." -else - echo >&2 "No full dump of $timestamp done yet." - exit 1 -fi - -rm -f this-fulldump -since="`cat lfull.$timestamp`" -doing="incremental since dump of $timestamp at `cat lfull.$timestamp` to $device" - ->increm-log -chmod 660 increm-log - -echo Doing "$doing" ... -echo "$doing": >>increm-log -cat fsys.all -echo "tar -lvvc \"-N$since\" -T$dir/fsys.all -f - \\" -echo " 2>>increm-log | dd of=$device bs=${blocksize}b" -echo "FAILED during incremental" >this-status -cd / -tar -lvvc "-N$since" -T$dir/fsys.all -f - 2>>$dir/increm-log \ - | dd of=$device bs=${blocksize}b -cd $dir - -echo "FAILED during cleanup" >this-status - -test -f this-fulldump && mv this-fulldump "lfull.$filesystems" -echo "$doing" completed. - -echo "Next dump tape to use would be `cat next-full`". - -echo "INCREMENTAL successful" >this-status diff --git a/backup/readbuffer b/backup/readbuffer deleted file mode 100755 index b5ab670..0000000 Binary files a/backup/readbuffer and /dev/null differ diff --git a/backup/readbuffer.c b/backup/readbuffer.c index b733fd6..ec03c6a 100644 --- a/backup/readbuffer.c +++ b/backup/readbuffer.c @@ -1,7 +1,15 @@ /* * readbuffer.c * - * Copyright (C) 1997,1998 Ian Jackson + * A program for reading input from devices which don't like constant + * stopping and starting, such as tape drives. readbuffer is: + * Copyright (C) 1997-1998,2000-2001 Ian Jackson + * + * readbuffer is part of chiark backup, a system for backing up GNU/Linux and + * other UN*X-compatible machines, as used on chiark.greenend.org.uk. + * chiark backup is: + * Copyright (C) 1997-1998,2000-2001 Ian Jackson + * Copyright (C) 1999 Peter Maydell * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as diff --git a/backup/settings.pl b/backup/settings.pl index a550206..b503f91 100644 --- a/backup/settings.pl +++ b/backup/settings.pl @@ -1,4 +1,5 @@ -# +# configuration, for putting in /etc/backup + chdir '/var/local/backup' or die $!; push(@INC,'/usr/local/lib/backup'); $ENV{'PATH'} =~ s,^/usr/local/lib/backup:/usr/local/bin:,,; diff --git a/backup/takedown b/backup/takedown index e41c783..76f68b4 100755 --- a/backup/takedown +++ b/backup/takedown @@ -1,6 +1,27 @@ #!/bin/sh +# takedown +# Entry point for cron to take the system down for backups # -# Take the system down for backups and then bring it back up. +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # Expects a single (possibly empty) argument X which is used to select # a file /etc/backup/warnings.X. This file will contain lines like: # T 300 "in 10 minutes" diff --git a/backup/whatsthis b/backup/whatsthis index 00d5dff..d631869 100755 --- a/backup/whatsthis +++ b/backup/whatsthis @@ -1,7 +1,27 @@ #!/usr/bin/perl +# whatsthis +# read an id off the tape and display it to the user + +# This file is part of chiark backup, a system for backing up GNU/Linux and +# other UN*X-compatible machines, as used on chiark.greenend.org.uk. +# +# chiark backup is: +# Copyright (C) 1997-1998,2000-2001 Ian Jackson +# Copyright (C) 1999 Peter Maydell +# +# This is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# This is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# whatsthis : just read an ID off the tape and display it to the user. -# Peter Maydell # First rough hack; mostly just code nabbed from full. # --list assumes the dump type was 'zafio', which is a bit bogus. diff --git a/backup/writebuffer b/backup/writebuffer deleted file mode 100755 index 67db196..0000000 Binary files a/backup/writebuffer and /dev/null differ diff --git a/backup/writebuffer.c b/backup/writebuffer.c index 02254dc..bb1d26f 100644 --- a/backup/writebuffer.c +++ b/backup/writebuffer.c @@ -1,7 +1,15 @@ /* * writebuffer.c * - * Copyright (C) 1997,1998 Ian Jackson + * A program for writing output to devices which don't like constant + * stopping and starting, such as tape drives. writebuffer is: + * Copyright (C) 1997-1998,2000-2001 Ian Jackson + * + * writebuffer is part of chiark backup, a system for backing up GNU/Linux + * and other UN*X-compatible machines, as used on chiark.greenend.org.uk. + * chiark backup is: + * Copyright (C) 1997-1998,2000-2001 Ian Jackson + * Copyright (C) 1999 Peter Maydell * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as