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/LICENSE)
24 if(! ~ $distisfrom local && ! ~ $download done){
28 if(! ~ $#mountmedia 0 1){
32 if(mountdist checkdone)
38 export srvmedia mountmedia mountdist
46 echo Please wait... Scanning storage devices...
48 parts=`{ls /dev/sd[A-Z][0-9]*/* >[2]/dev/null | grep -v '/(plan9.*|ctl|log|raw)$'}
51 n=`{echo $i | sed 's;/;_;g'}
52 if(! test -f /tmp/localpart.$n)
53 dd -if $i -bs 2048 -count 32 -of /tmp/localpart.$n >[2]/dev/null
54 if(isfat /tmp/localpart.$n)
56 if(isext2 /tmp/localpart.$n)
58 if(is9660 /tmp/localpart.$n)
63 echo The following storage media were detected.
64 echo Choose the one containing the distribution.
69 echo ' '^$i^' (microsoft fat)'
71 echo ' '^$i^' (linux ext2)'
73 echo ' '^$i^' (iso9660 cdrom)'
79 while(! ~ $mountstatus ''){
81 if(! ~ $#cdboot 0 && ! ~ $#x9660 0)
82 default=(-d $x9660(1))
83 prompt $default 'Distribution disk' $fat $x9660
90 mountmedia=(bind /n/newfs /n/distmedia)
93 mountmedia=(mount /srv/dos /n/distmedia $disk)
96 mountmedia=(mount /srv/ext2 /n/distmedia $disk)
99 mountmedia=(mount /srv/9660 /n/distmedia $disk)
101 echo Unknown disk type '(cannot happen)'
104 export srvmedia mountmedia
111 while(~ $first yes || ! havedist /n/distmedia/$dir){
114 echo Which directory contains the distribution?
115 echo 'Any of the following will suffice (in order of preference):'
116 echo ' - the root directory of the cd image'
121 prompt -d $dir 'Location of archives'
127 if(! havedist /n/distmedia/$dir)
128 echo 'No distribution found in '^`{cleanname /$dir}
135 if(! ~ $#distmediadir 1){
140 if(! havedist /n/distmedia/$distmediadir && ! havedist /n/newfs/dist){
148 if(havedist /n/distmedia/$distmediadir){
149 bind /n/distmedia/$distmediadir /n/dist