]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/boot/local.rc
inst: reintroduce iso mounting for usb, replace /rc/bin/inst/isxxx with /rc/bin/fstyp...
[plan9front.git] / sys / src / 9 / boot / local.rc
1 #!/bin/rc
2
3 fn showlocaldevs{
4         echo local devices found:
5         for(d in /dev/sd*){
6                 if(test -r $d/ctl){
7                         q=`{sed 's,(inquiry|geometry),\
8 \1,g' $d/ctl | grep inquiry}
9                         echo $d':' $q(2-)
10                         for(i in `{ls -p $d}){
11                                 p=$d/$i
12                                 switch($i){
13                                 case ctl raw log
14                                         ;
15                                 case 9fat plan9 nvram
16                                         echo $p
17                                 case *
18                                         t=`{fstype $p}
19                                         if(~ $#bootargs 0 && ! ~ $t '')
20                                                 bootargs=local!$p
21                                         echo $p $t
22                                 }
23                         }
24                 }
25         }
26 }
27
28 fn configlocal{
29         diskparts
30 }
31
32 fn bootfs{
33         {$1 -s -f $*(2-) &} <[0=1] | echo 0 >/srv/boot
34 }
35
36 fn connectlocal{
37         if(test -r $1)
38                 t=`{fstype $1}
39         if not {
40                 t=$1; shift
41         }
42         switch($t){
43         case ''
44                 fatal unknown fstype $1
45         case 9660
46                 bootfs 9660srv $*
47         case kfs
48                 bootfs disk/kfs $*
49         case dos
50                 if(! test -f /srv/dos)
51                         dossrv
52                 m=/mnt/dosboot
53                 must mount /srv/dos $m $1
54                 shift
55                 if(~ $#* 0)
56                         f=$m/9front.iso
57                 if not
58                         f=$m/$1
59                 if(test -r $f)
60                         connectlocal $f
61                 if not
62                         connectlocal $*
63         case *
64                 bootfs $t $*
65         }
66 }
67
68 mlocal=(configlocal connectlocal)
69 mt=(mlocal $mt)