xref: /plan9/sys/lib/dist/pc/inst/download (revision d8635c2e197bbca90dd25be5412584a55b796e27)
1#!/bin/rc
2
3# prereq: mountfs
4# desc: download or continue to download the distribution archives
5
6switch($1) {
7case checkready
8	devs=(`{cat /net/ipifc/*/status >[2]/dev/null |
9		grep -v '127\.0\.0\.1' |
10		sed 's/ .*//'})
11	if(~ $#devs 0) {
12		download=notdone
13		export download
14	}
15	if(~ $mountdist done){
16		download=notdone
17		export download
18	}
19
20case go
21	if(! test -f /srv/cs) {
22		log starting cs, dns
23		logprog ndb/cs >>/srv/log >[2=1]
24		logprog ndb/dns -r >>/srv/log >[2=1]
25	}
26	if(! test -f /net/cs) {
27		logprog mount -a /srv/cs /net
28		logprog mount -a /srv/dns /net
29	}
30
31	# BUG make restartable
32	echo 'Downloading distribution package...'
33	baropt='-w 145,129,445,168'
34	if(~ $textinst 1)
35		baropt=-t
36	if(! hget -vo /n/newfs/dist/_plan9.iso.bz2 $installurl/plan9.iso.bz2 |[2] bargraph $baropt 'downloading '^plan9.iso.bz2)
37			exit
38	mv /n/newfs/dist/_plan9.iso.bz2 /n/newfs/dist/plan9.iso.bz2
39	if(~ $fstype fossil){
40		echo fsys main sync >>/srv/fscons
41	}
42
43	echo 'The distribution is downloaded.'
44
45	srvmedia=()
46	mountmedia=(mount /srv/fossil /n/distmedia)
47	distmediadir=/dist
48	export distmediadir mountmedia distmedia
49
50case checkdone
51	if(! test -f /n/newfs/dist/plan9.iso.bz2) {
52		download=notdone
53		export download
54	}
55}
56
57