]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/boot/bootrc
provide /n and /mnt early in bootrc to allow consistent use in /lib/namespace
[plan9front.git] / sys / src / 9 / boot / bootrc
index e4d45635baf9732c3e8cdd5c9af08c61df6c8965..b8c96cc171c9227c8943270e75395b67f2af3013 100755 (executable)
@@ -1,9 +1,14 @@
 #!/bin/rc
 
-mntgen -s slash /mnt
+# mount points
+mntgen -s slashn /n && chmod 666 /srv/slashn
+mntgen -s slashmnt /mnt && chmod 666 /srv/slashmnt
+mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport
+
 bind /root /mnt/broot
 unmount /root
 
+bind -q '#d' /fd
 bind -q '#p' /proc
 for(i in S f k æ t b m)
        bind -qa '#'^$i /dev
@@ -69,8 +74,9 @@ fn main{
                }
                if not bootargs=$nobootprompt
                nobootprompt=()
-               mn=`{echo $bootargs | awk -F! '{print $1}'}
-               ma=`{echo $bootargs | sed 's/[^!]*!?//'}
+               mn=`{echo $bootargs | sed 's,!, ,'}
+               ma=$mn(2-)
+               mn=$mn(1)
                switch(m$"mn){
                case $mt
                        mp=m$mn
@@ -88,8 +94,6 @@ fn main{
                }
                if not
                        x=($x -u)
-               if(! ~ $#auth 0)
-                       x=($x -a $auth)
                if(! ~ $#debugfactotum 0)
                        x=($x -p)
                must $x
@@ -98,9 +102,11 @@ fn main{
        # config method
        $mp(1) $ma
 
-       # load keys from secstore
-       if(~ $#auth 1 && test -x /bin/auth/secstore && test -f /mnt/factotum/ctl){
-               x=(auth/secstore -G factotum -s $auth)
+       # load keys from secstore if $auth or $secstore is not empty
+       x=secstore
+       if(~ $#$x 0) x=auth
+       if(! ~ $#$x 0 && test -x /bin/auth/secstore && test -f /mnt/factotum/ctl){
+               x=(auth/secstore -G factotum -s^$$x)
                if(~ $service cpu)
                        $x -n >/mnt/factotum/ctl
                if(~ $status *readnvram* || ! ~ $service cpu)
@@ -144,7 +150,7 @@ fn main{
        }
 
        # remove enviroment variables
-       rm -f /env/^$mt /env/? /env/?? '/env/fn#'* 
+       rm -f '#e/'^$mt '#e/'? '#e/'?? '#e/fn#'* 
 
        # remove part of our temporary root
        /mnt/broot/$cputype/bin/unmount /$cputype/bin /bin
@@ -173,14 +179,12 @@ if(test -x /bin/aux/kbdfs){
 if(test -x /bin/nusbrc && ! test -e /env/nousbrc)
        nusbrc
 
-# wait for devices to settle down
-if(~ $#usbwait 1)
-       sleep $usbwait
-if(~ $#usbwait 0)
-       sleep 2
-
-. /rc/lib/net.rc
-. /rc/lib/local.rc
+# load boot methods
+fn showlocaldevs {}
+fn configlocal {}
+for(i in /rc/lib/*.rc){
+       . $i
+}
 
 # add partitions and binds
 configlocal
@@ -229,5 +233,5 @@ while(){
 
        # cleanup so it can be restarted
        nobootprompt=()
-       rm -f /srv/^(cfs boot slashn cs dns)
+       rm -f /srv/^(cfs boot cs dns)
 } </dev/cons