X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=sys%2Fsrc%2F9%2Fboot%2Fbootrc;h=61da33c0df0cdf5499b7a833c087e2845862d763;hb=c3105131feb2344f64ae5169df3b024ecdbe814c;hp=0a9e45108909ed69fbc72525df2ec7bd0f23343a;hpb=e1488b2de7c50dbb5657f469fc0e6c3afd34f4a0;p=plan9front.git diff --git a/sys/src/9/boot/bootrc b/sys/src/9/boot/bootrc index 0a9e45108..61da33c0d 100644 --- a/sys/src/9/boot/bootrc +++ b/sys/src/9/boot/bootrc @@ -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 >[2]/dev/cons +}