chiark / gitweb /
From Peter Maydell (/u2/pmaydell/iwjbackup/) as per <E156bwm-0005xq-00@watchdragon...
[chiark-utils.git] / backup / old-increm
1 #!/bin/sh
2
3 set -e
4 false
5 dir=/var/local/backup
6 device=/dev/sda4
7 blocksize=2048
8 filesystems=all
9
10 cd $dir
11 PATH=/usr/local/lib/backup:$PATH export PATH
12
13 echo "FAILED during startup of incremental" >this-status
14
15 timestamp='.'
16 for tsfs in `cat all-fsys-n`
17 do
18         echo "Checking timestamp of last full dump of $tsfs;"
19         if ! test "lfull.$timestamp" -ot "lfull.$tsfs"
20         then
21                 timestamp="$tsfs"
22         fi
23 done
24
25 if test -f "lfull.$timestamp"
26 then
27         echo "Using timestamp of last full dump of $timestamp."
28 else
29         echo >&2 "No full dump of $timestamp done yet."
30         exit 1
31 fi
32
33 rm -f this-fulldump
34 since="`cat lfull.$timestamp`"
35 doing="incremental since dump of $timestamp at `cat lfull.$timestamp` to $device"
36
37 >increm-log
38 chmod 660 increm-log
39
40 echo Doing "$doing" ...
41 echo "$doing": >>increm-log
42 cat fsys.all
43 echo "tar -lvvc \"-N$since\" -T$dir/fsys.all -f - \\"
44 echo "  2>>increm-log | dd of=$device bs=${blocksize}b"
45 echo "FAILED during incremental" >this-status
46 cd /
47 tar -lvvc "-N$since" -T$dir/fsys.all -f - 2>>$dir/increm-log \
48         | dd of=$device bs=${blocksize}b
49 cd $dir
50
51 echo "FAILED during cleanup" >this-status
52
53 test -f this-fulldump && mv this-fulldump "lfull.$filesystems"
54 echo "$doing" completed.
55
56 echo "Next dump tape to use would be `cat next-full`".
57
58 echo "INCREMENTAL successful" >this-status