2011-04-16 20:42:16 +00:00
|
|
|
#!/bin/rc
|
|
|
|
|
2011-04-19 05:24:46 +00:00
|
|
|
fn showlocaldevs{
|
|
|
|
echo local devices found:
|
2011-05-02 01:21:55 +00:00
|
|
|
for(d in /dev/sd*){
|
|
|
|
if(test -r $d/ctl){
|
|
|
|
q=`{sed 's,(inquiry|geometry),\
|
|
|
|
\1,g' $d/ctl | grep inquiry}
|
|
|
|
echo $d':' $q(2-)
|
|
|
|
for(i in `{ls -p $d}){
|
2011-04-21 12:49:59 +00:00
|
|
|
p=$d/$i
|
2011-05-02 01:21:55 +00:00
|
|
|
switch($i){
|
2011-05-02 03:01:52 +00:00
|
|
|
case ctl raw log
|
2011-05-02 01:21:55 +00:00
|
|
|
;
|
|
|
|
case 9fat plan9 nvram
|
|
|
|
echo $p
|
|
|
|
case *
|
|
|
|
t=`{fstype $p}
|
|
|
|
if(~ $#bootargs 0 && ! ~ $t '')
|
|
|
|
bootargs=local!$p
|
|
|
|
echo $p $t
|
|
|
|
}
|
2011-04-21 12:49:59 +00:00
|
|
|
}
|
2011-04-21 10:40:03 +00:00
|
|
|
}
|
2011-04-19 05:24:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-16 20:42:16 +00:00
|
|
|
fn configlocal{
|
|
|
|
diskparts
|
2011-05-02 01:21:55 +00:00
|
|
|
}
|
2011-04-19 05:24:46 +00:00
|
|
|
|
2011-05-02 01:21:55 +00:00
|
|
|
fn bootfs{
|
|
|
|
{$1 -s -f $*(2-) &} <[0=1] | echo 0 >/srv/boot
|
2011-04-16 20:42:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn connectlocal{
|
2011-05-02 01:21:55 +00:00
|
|
|
if(test -r $1)
|
|
|
|
t=`{fstype $1}
|
|
|
|
if not {
|
|
|
|
t=$1; shift
|
|
|
|
}
|
2011-04-21 10:40:03 +00:00
|
|
|
switch($t){
|
2011-05-02 01:21:55 +00:00
|
|
|
case ''
|
|
|
|
fatal unknown fstype $1
|
2011-04-21 10:40:03 +00:00
|
|
|
case 9660
|
2011-05-02 01:21:55 +00:00
|
|
|
bootfs 9660srv $*
|
2011-04-21 10:40:03 +00:00
|
|
|
case kfs
|
2011-05-02 01:21:55 +00:00
|
|
|
bootfs disk/kfs $*
|
|
|
|
case dos
|
|
|
|
if(! test -f /srv/dos)
|
|
|
|
dossrv
|
|
|
|
m=/mnt/dosboot
|
|
|
|
must mount /srv/dos $m $1
|
|
|
|
shift
|
|
|
|
if(~ $#* 0)
|
|
|
|
f=$m/9front.iso
|
|
|
|
if not
|
|
|
|
f=$m/$1
|
|
|
|
if(test -r $f)
|
|
|
|
connectlocal $f
|
|
|
|
if not
|
|
|
|
connectlocal $*
|
|
|
|
case *
|
|
|
|
bootfs $t $*
|
2011-04-16 20:42:16 +00:00
|
|
|
}
|
|
|
|
}
|
2011-04-21 22:22:25 +00:00
|
|
|
|
|
|
|
mlocal=(configlocal connectlocal)
|
|
|
|
mt=(mlocal $mt)
|