xref: /plan9/sys/lib/backup/backuparenas (revision f44e8c008ee019673580999bb166551778627b1e)
1#!/bin/rc
2# backuparenas dev name ... - dump arena `name' from $fs to blu-ray disc.
3#	assumes $set is set.
4rfork ne
5# tunable variables
6fs=pie
7
8if (test -e /sys/lib/backup/funcs)
9	.   /sys/lib/backup/funcs
10
11exits=''
12fsroot=/n/$fs
13if (! test -e $fsroot/!THIS_IS_^`{echo $fs | tr a-z A-Z}^_MAIN) {
14	import $fs / $fsroot || exit
15}
16unmount /mnt/cd >[2]/dev/null
17cdfs -d $1 || exit
18shift
19
20done=no
21echo -n figuring out disc type...
22for (i in `{seq 1 20})
23	if (~ $done no) {
24		m=`{ls -l /mnt/cd | grep bd-r-dl}
25		if (~ $m '' ()) {
26			echo -n .
27			sleep 3
28		}
29		if not
30			done=yes
31	}
32echo
33
34ls -l /mnt/cd
35grep next /mnt/cd/ctl
36echo -n 'nwa ok? '
37ok=`{read}
38if (! ~ $ok [Yy]*)
39	exit bad-nwa
40
41cd $fsroot/dev/fs
42shname = `{basename $arenas}
43if (! test -r $shname){
44	echo $0: $shname in `{pwd} not readable >[1=2]
45	exit unreadable-arenas
46}
47
48for (name) {
49	grep next /mnt/cd/ctl
50	# use -o 8192 to avoid devmnt fragmentation if bd drive is imported
51	venti/rdarena $shname $name |
52		pump -i 65536 -o 8192 -k 100000 -d 5 >/mnt/cd/wd/$name
53#		pump -i 65536 -o 1048576 -k 51200 -d 10 >/mnt/cd/wd/$name
54	quitonfailure $status
55
56#	ls -l /mnt/cd
57	if (test -e '/env/fn#dumpdone' -a -e '/env/set')
58		dumpdone $shname $name
59}
60echo 'remember to *not* remove /mnt/cd/wd' >[1=2]
61# don't remove /mnt/cd/wd, since that would finalize the disc
62# and bugger the permanent toc, at least on bd-r.
63exit ''
64