for(i in I l^(0 1 2 3))
bind -qa '#'$i /net
-# 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
+# usualy better than 1970
+cat '#r/rtc' >/dev/time >[2]/dev/null
+
+# 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 {
}
mt=()
-. /rc/lib/tcp.rc
+. /rc/lib/net.rc
. /rc/lib/local.rc
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=()
$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
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
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