]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/9/boot/bootrc
bootrc: fix mistake, god damn it
[plan9front.git] / sys / src / 9 / boot / bootrc
index 0a9e45108909ed69fbc72525df2ec7bd0f23343a..61da33c0df0cdf5499b7a833c087e2845862d763 100644 (file)
@@ -15,14 +15,18 @@ for(i in I l^(0 1 2 3))
 # usualy better than 1970
 cat '#r/rtc' >/dev/time >[2]/dev/null
 
-# reparse #ec variables, move to #e
-for(i in init service sysname user nvram rootdir cfs bootdisk bootargs \
-       nobootprompt debugfactotum fs fsaddr auth authaddr console){
-       a=`{echo $$i}
-       $i=()
-       rm -f '#e'/$i '#ec'/$i
-       if(! ~ $#a 0)
-               $i=$a
+# reparse variables
+for(i in `{ls -Qp /env}){
+       switch($i){
+       case '*'* 'fn#'* e820 apm0 apid ifs path pid prompt status ?
+               # ignore these
+       case *
+               $i=`{echo $$i}
+       }
+}
+
+fn sigint {
+       status=interrupted
 }
 
 fn fatal {
@@ -54,7 +58,7 @@ fn ask {
 }
 
 mt=()
-. /rc/lib/tcp.rc
+. /rc/lib/net.rc
 . /rc/lib/local.rc
 
 fn main{
@@ -63,7 +67,7 @@ fn main{
                if(~ $#nobootprompt 0){
                        echo
                        showlocaldevs
-                       ask bootargs ' is (tcp, local!device)' $"bootargs
+                       ask bootargs ' is (tcp, il, local!device)' $"bootargs
                }
                if not bootargs=$nobootprompt
                nobootprompt=()
@@ -80,22 +84,23 @@ fn main{
        $mp(1) $ma
 
        # authentication agent
-       if(! test -f /srv/factotum){
-               x=(/boot/factotum -sfactotum)
-               if(~ $service cpu){
-                       x=($x -S)
-                       if(~ -k $ff)
-                               x=($x -k)
-               }
-               if not
-                       x=($x -u)
-               if(! ~ $#authaddr 0)
-                       x=($x -a $authaddr)
-               if(! ~ $#debugfactotum 0)
-                       x=($x -p)
-               must $x
+       if(test -f /srv/factotum){
+               rm -f /srv/factotum
+               user=`{cat /dev/hostowner}
+       }
+       x=(/boot/factotum -sfactotum)
+       if(~ $service cpu){
+               x=($x -S)
+               if(~ -k $ff)
+                       x=($x -k)
        }
-       if not user=`{cat /dev/hostowner}
+       if not
+               x=($x -u)
+       if(! ~ $#auth 0)
+               x=($x -a $auth)
+       if(! ~ $#debugfactotum 0)
+               x=($x -p)
+       must $x
 
        # connect method
        $mp(2) $ma
@@ -156,11 +161,15 @@ if(test -x /bin/aux/kbdfs){
        a=$console(1)
        if(! ~ $#a 0)
                a=/dev/eia^$a
-       aux/kbdfs -s cons $a
+       aux/kbdfs -q -s cons $a
 }
 
 # usb devices
-nusbrc
+if(test -x /bin/nusbrc && ! test -e /env/nousbrc)
+       nusbrc
+
+# wait for devices to settle down
+sleep 2
 
 # add partitions and binds
 configlocal
@@ -204,8 +213,10 @@ if(! ~ $#aa 0 && ~ $#bootargs 0 && ~ $#nobootprompt 0){
 while(){
        @{main}
 
+       # subshell doesnt wait on interrupts
+       while(~ $status interrupted){wait}
+
        # cleanup so it can be restarted
        nobootprompt=()
-       user=()
        rm -f /srv/^(cfs boot slashn cs dns)
-} </dev/cons >/dev/cons >[2]/dev/cons 
+} </dev/cons