diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 16:53:33 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 16:53:33 +0300 |
commit | e463eb40363ff4c68b1d903f4e0cdd0ac1c5977f (patch) | |
tree | d5e9f57c28f026cb21de3bd77cc10cd7f64aaa85 /sys/lib/backup/tobackup | |
parent | b41b9034225ab3e49980d9de55c141011b6383b0 (diff) |
Import sources from 2011-03-30 iso image - sys/lib
Diffstat (limited to 'sys/lib/backup/tobackup')
-rwxr-xr-x | sys/lib/backup/tobackup | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sys/lib/backup/tobackup b/sys/lib/backup/tobackup new file mode 100755 index 000000000..d14b7f838 --- /dev/null +++ b/sys/lib/backup/tobackup @@ -0,0 +1,47 @@ +#!/bin/rc +# tobackup [set] - print names of venti arenas needing to be dumped to disc set +rfork e + +cd /sys/lib/backup +. funcs + +switch ($#*) { +case 0 +case 1 + set=$1 +case * + echo usage: $0 '[set]' >[1=2] + exit usage +} + +if (! test -d $set) { + echo $0: no backup set named $set in $backup >[1=2] + exit 'no backup set' +} +if (! hget -o index http://$fs/index) { + echo $0: 'can''t fetch venti index from' $fs >[1=2] + exit 'no venti index' +} +if (! test -s index) { + echo $0: 'empty venti index from' $fs >[1=2] + exit 'empty index' +} + +cd $set +awk '/^arena=/ { name=$1 } + / disk=sealed/ { print name; name = "" } + ' ../index | sed 's/^arena=//' >nsealed +>>sealed +if (! cmp -s sealed nsealed) + cp nsealed sealed +rm -f nsealed +if (! test -s sealed) + exit '' + +>>fake +if (test -s ondisc) + comm -23 <{sort -u sealed fake} <{sort -u ondisc} +if not { # first sealed arenas, dump all + cat sealed + chmod +a ondisc >>ondisc +} |