chiark / gitweb /
Found on davenant in /usr/local/lib (in use on anarres).
[chiark-utils.git] / backup / old-increm
diff --git a/backup/old-increm b/backup/old-increm
new file mode 100755 (executable)
index 0000000..b036b89
--- /dev/null
@@ -0,0 +1,58 @@
+#!/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