plan9fox/sys/src/9/boot/local.rc

76 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/rc
fn showlocaldev {
echo $1' ' $2
if(~ $#bootargs 0){
if(! ~ $#cdboot 0){
if(~ $2 9660)
bootargs=local!$1
}
if not {
if(! ~ $2 '' dos)
bootargs=local!$1
}
}
}
2011-04-19 05:24:46 +00:00
fn showlocaldevs{
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}){
p=$d/$i
switch($i){
2012-02-28 20:42:25 +00:00
case ctl raw log led
;
case plan9 nvram swap
echo $p
case *
showlocaldev $p `{fstype $p}
}
}
}
for(d in /shr/sd*) if(test -d $d) {
echo $d':'
2015-08-21 17:53:43 +00:00
for(p in $d/*.^(iso paq)) if(test -f $p){
t=`{fstype $p}
~ $#t 0 || showlocaldev $p $t
}
2011-04-19 05:24:46 +00:00
}
}
fn configlocal{
diskparts
}
2011-04-19 05:24:46 +00:00
fn bootfs{
{$1 -s -f $*(2-) <[0=1] &} | echo 0 >/srv/boot
}
fn connectlocal{
2012-12-05 12:53:34 +00:00
if(~ $#* 0){
echo local method needs an argument
}
2012-12-05 12:53:34 +00:00
if not {
if(test -f $1)
t=`{fstype $1}
if not {
t=$1; shift
}
switch($t){
case ''
fatal unknown fstype $1
case 9660
bootfs 9660srv $*
case dos
bootfs dossrv $*
case *
bootfs $t $*
}
}
}
mlocal=(configlocal connectlocal)
mt=(mlocal $mt)