summaryrefslogtreecommitdiff
path: root/sys/lib/dist/pc/inst/download
blob: 70d7f5ba75af59a49b9eaf2e5fd309f8b009341c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/rc

# prereq: mountfs
# desc: download or continue to download the distribution archives

switch($1) {
case checkready
	devs=(`{cat /net/ipifc/*/status >[2]/dev/null |
		grep -v '127\.0\.0\.1' |
		sed 's/ .*//'})
	if(~ $#devs 0) {
		download=notdone
		export download
	}
	if(~ $mountdist done){
		download=notdone
		export download
	}

case go
	if(! test -f /srv/cs) {
		log starting cs, dns
		logprog ndb/cs >>/srv/log >[2=1]
		logprog ndb/dns -r >>/srv/log >[2=1]
	}
	if(! test -f /net/cs) {
		logprog mount -a /srv/cs /net
		logprog mount -a /srv/dns /net
	}

	# BUG make restartable
	echo 'Downloading distribution package...'
	baropt='-w 145,129,445,168'
	if(~ $textinst 1)
		baropt=-t
	if(! hget -vo /n/newfs/dist/_plan9.iso.bz2 $installurl/plan9.iso.bz2 |[2] bargraph $baropt 'downloading '^plan9.iso.bz2)
			exit
	mv /n/newfs/dist/_plan9.iso.bz2 /n/newfs/dist/plan9.iso.bz2
	if(~ $fstype fossil){
		echo fsys main sync >>/srv/fscons
	}

	echo 'The distribution is downloaded.'

	srvmedia=()
	mountmedia=(mount /srv/fossil /n/distmedia)
	distmediadir=/dist
	export distmediadir mountmedia distmedia
	
case checkdone
	if(! test -f /n/newfs/dist/plan9.iso.bz2) {
		download=notdone
		export download
	}
}