3 # prereq: mountfs configdist
4 # desc: locate and mount the distribution
7 if(! test -e $mountmedia(2))
9 unmount /n/distmedia >[2]/dev/null
14 if(test -f /n/dist/dist/replica/plan9.db)
22 9660srv 9660.dist >[2]/dev/null
23 logprog mount /srv/9660.dist /n/dist $1
33 echo -n 'bunzip2 < '^$1^' >/n/newfs/dist/plan9.iso'
34 bunzip2 < $1 >/n/newfs/dist/_plan9.iso &&
35 mv /n/newfs/dist/_plan9.iso /n/newfs/dist/plan9.iso
37 trycdimage /n/newfs/dist/plan9.iso
45 test -f $1/dist/replica/plan9.db ||
46 test -f $1/plan9.iso ||
47 test -f $1/plan9.iso.bz2
52 if(! ~ $distisfrom local && ! ~ $download done){
56 if(! ~ $#mountmedia 0 1){
60 if(mountdist checkdone)
66 export srvmedia mountmedia mountdist
75 echo Please wait... Scanning storage devices...
77 parts=`{ls /dev/sd??/* >[2]/dev/null | grep -v '/(plan9.*|ctl|log|raw)$'}
80 n=`{echo $i | sed 's;/;_;g'}
81 if(! test -f /tmp/localpart.$n)
82 dd -if $i -bs 2048 -count 32 -of /tmp/localpart.$n >[2]/dev/null
83 if(isfat /tmp/localpart.$n)
85 if(isext2 /tmp/localpart.$n)
87 if(is9660 /tmp/localpart.$n)
94 echo The following storage media were detected.
95 echo Choose the one containing the distribution.
100 echo ' '^$i^' (microsoft fat)'
102 echo ' '^$i^' (linux ext2)'
104 echo ' '^$i^' (iso9660 cdrom)'
106 echo ' '^$i^' (plan9 fossil)'
112 while(! ~ $mountstatus ''){
113 prompt -w '' 'Distribution disk' $fat $x9660 $fossil
120 mountmedia=(bind /n/newfs /n/distmedia)
123 mountmedia=(mount /srv/dos /n/distmedia $disk)
125 srvmedia=(ext2srv -r)
126 mountmedia=(mount /srv/ext2 /n/distmedia $disk)
129 mountmedia=(mount /srv/9660 /n/distmedia $disk)
131 echo 'srv fossil.mountdist' > /tmp/fossi.conf
132 echo 'fsys main config '^$disk >> /tmp/fossil.conf
133 echo 'fsys main open -AWVP' >> /tmp/fossil.conf
134 echo 'fsys main' >> /tmp/fossil.conf
135 srvmedia=(fossil/fossil -c '. /tmp/fossil.conf')
136 mountmedia=(mount /srv/fossil.mountdist /n/distmedia)
138 echo Unknown disk type '(cannot happen)'
141 export srvmedia mountmedia
148 while(~ $first yes || ! havedist /n/distmedia/$dir){
151 echo Which directory contains the distribution?
152 echo 'Any of the following will suffice (in order of preference):'
153 echo ' - the root directory of the cd image'
154 echo ' - the directory containing plan9.iso'
155 echo ' - the directory containing plan9.iso.bz2'
156 echo 'Typing `browse'' will put you in a shell that you can use to'
157 echo 'look for the directory.'
162 prompt -d browse 'Location of archives'
165 echo This is a simple shell. Commands are:
166 echo ' cd directory - change to directory'
167 echo ' lc - list contents of current directory'
168 echo ' exit - exit shell'
170 echo 'Move to the directory containing the distribution'
171 echo 'and then exit.'
175 dir=`{cdsh -r /n/distmedia}
182 if(! havedist /n/distmedia/$dir)
183 echo 'No distribution found in '^`{cleanname /$dir}
190 if(! ~ $#distmediadir 1){
195 if(! havedist /n/distmedia/$distmediadir && ! havedist /n/newfs/dist){
203 if(test -f /n/distmedia/$distmediadir/dist/replica/plan9.db){
204 bind /n/distmedia/$distmediadir /n/dist
205 bind -a /n/dist/386/bin /bin
206 bind -a /n/dist/rc/bin /bin
213 trycdimage /n/distmedia/$distmediadir/plan9.iso
214 trycdimage /n/newfs/dist/plan9.iso
216 trycdimagebz2 /n/distmedia/$distmediadir/plan9.iso.bz2
217 trycdimagebz2 /n/newfs/dist/plan9.iso.bz2