+# 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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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
+# 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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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
fsys.all: ifsys.prefixes ifsys.pt0 ifsys.pt1 ifsys.pt2 ifsys.end
cat $^ >$@.new && mv -f $@.new $@
+
+# 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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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";
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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';
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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';
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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';
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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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
+++ /dev/null
-
-
-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" ...
-
-
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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
+++ /dev/null
-#!/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
/*
* readbuffer.c
*
- * Copyright (C) 1997,1998 Ian Jackson <ian@chiark.greenend.org.uk>
+ * 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 <ian@chiark.greenend.org.uk>
+ *
+ * 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 <ian@chiark.greenend.org.uk>
+ * Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
-#
+# 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:,,;
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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"
#!/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 <ian@chiark.greenend.org.uk>
+# Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
+#
+# 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 <pmaydell@chiark.greenend.org.uk>
# First rough hack; mostly just code nabbed from full.
# --list assumes the dump type was 'zafio', which is a bit bogus.
/*
* writebuffer.c
*
- * Copyright (C) 1997,1998 Ian Jackson <ian@chiark.greenend.org.uk>
+ * 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 <ian@chiark.greenend.org.uk>
+ *
+ * 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 <ian@chiark.greenend.org.uk>
+ * Copyright (C) 1999 Peter Maydell <pmaydell@chiark.greenend.org.uk>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as