9boot: list known filesystem images on usb stick as boot filesystems
This commit is contained in:
parent
9884f5f0ed
commit
828f63711b
3 changed files with 36 additions and 41 deletions
|
@ -25,6 +25,7 @@ if(! bind -a '#u' /dev)
|
|||
}
|
||||
}
|
||||
fn detach {
|
||||
# handled /sys/src/9/boot/nusbrc
|
||||
}
|
||||
rc < '#σ/usb/usbevent' &
|
||||
}
|
||||
|
|
|
@ -2,24 +2,33 @@
|
|||
|
||||
fn showlocaldevs{
|
||||
echo local devices found:
|
||||
for(d in /dev/sd*){
|
||||
if(test -r $d/ctl){
|
||||
q=`{sed 's,(inquiry|geometry),\
|
||||
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){
|
||||
case ctl raw log
|
||||
;
|
||||
case 9fat plan9 nvram
|
||||
echo $p
|
||||
case *
|
||||
t=`{fstype $p}
|
||||
if(~ $#bootargs 0 && ! ~ $t '')
|
||||
bootargs=local!$p
|
||||
echo $p $t
|
||||
}
|
||||
echo $d':' $q(2-)
|
||||
for(i in `{ls -p $d}){
|
||||
p=$d/$i
|
||||
switch($i){
|
||||
case ctl raw log
|
||||
;
|
||||
case 9fat plan9 nvram
|
||||
echo $p
|
||||
case *
|
||||
t=`{fstype $p}
|
||||
if(~ $#bootargs 0 && ! ~ $t '')
|
||||
bootargs=local!$p
|
||||
echo $p $t
|
||||
}
|
||||
}
|
||||
}
|
||||
for(d in /shr/sd*) if(test -d $d) {
|
||||
echo $d':'
|
||||
for(p in $d/*.^(iso kfs paq)) if(test -f $p){
|
||||
t=`{fstype $p}
|
||||
if(! ~ $t ''){
|
||||
if(~ $#bootargs 0)
|
||||
bootargs=local!$p
|
||||
echo $p $t
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +43,7 @@ fn bootfs{
|
|||
}
|
||||
|
||||
fn connectlocal{
|
||||
if(test -r $1)
|
||||
if(test -f $1)
|
||||
t=`{fstype $1}
|
||||
if not {
|
||||
t=$1; shift
|
||||
|
@ -44,22 +53,10 @@ fn connectlocal{
|
|||
fatal unknown fstype $1
|
||||
case 9660
|
||||
bootfs 9660srv $*
|
||||
case dos
|
||||
bootfs dossrv $*
|
||||
case kfs
|
||||
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 $*
|
||||
}
|
||||
|
|
|
@ -17,16 +17,13 @@ if(! nusb/usbd)
|
|||
@{
|
||||
rfork ne
|
||||
cd '#σ/usb'
|
||||
for(dev in sdU^$1.*){
|
||||
echo $dev...
|
||||
for(dev in sdU^$1.*) if(test -d $dev) {
|
||||
diskparts $dev
|
||||
for(part in $dev/dos* $dev/9fat){
|
||||
if(test -r $part) {
|
||||
mkdir -m 0700 '#σc/'^$dev
|
||||
{dossrv -s -f $part &} <[0=1] |
|
||||
echo 0 >'#σc/'^$dev/dos
|
||||
exit
|
||||
}
|
||||
for(part in $dev/dos* $dev/9fat) if(test -r $part) {
|
||||
mkdir -m 0700 '#σc/'^$dev || exit
|
||||
{dossrv -s -f $part &} <[0=1] |
|
||||
echo 0 >'#σc/'^$dev/dos
|
||||
exit
|
||||
}
|
||||
}
|
||||
} &
|
||||
|
|
Loading…
Reference in a new issue