4 mntgen -s slashn /n && chmod 666 /srv/slashn
5 mntgen -s slashmnt /mnt && chmod 666 /srv/slashmnt
6 mntgen -s mntexport /mnt/exportfs && chmod 666 /srv/mntexport
14 for(i in ¶ P S f æ t b m)
17 # bind in an ip interface
18 for(i in I l^(0 1 2 3))
21 # usually better than 1970
22 cat '#r/rtc' >/dev/time >[2]/dev/null
25 for(i in `{ls -Qp /env}){
27 case '*'* 'fn#'* e820 apm0 apid ifs path pid prompt status ?
44 $* || fatal $"*^': '^$status
55 $1=`{dd -bs 64 -count 1 >[2]/dev/null}
71 if(~ $#nobootprompt 0){
74 ask bootargs ' is (tcp, tls, il, local!device)' $"bootargs
76 if not bootargs=$nobootprompt
78 mn=`{echo $bootargs | sed 's,!, ,'}
88 # authentication agent
89 if(! test -f /srv/factotum){
90 # we remount ip inteface after hostowner is set
91 unmount '#I' /net >[2]/dev/null
93 x=(/boot/factotum -n -sfactotum)
98 if(! ~ $#debugfactotum 0)
108 # load keys from secstore if $auth or $secstore is not empty
111 if(! ~ $#$x 0 && test -x /bin/auth/secstore && test -f /mnt/factotum/ctl){
112 x=(auth/secstore -G factotum -s^$$x)
114 $x -n >/mnt/factotum/ctl
115 if(~ $status *readnvram* || ! ~ $service cpu)
116 $x >/mnt/factotum/ctl
122 # insert cfs in the pipeline
123 if(test -x /bin/cfs){
124 if(~ $#bootdisk 1 && ~ $#cfs 0)
126 if(~ $#cfs 1 && ! ~ $cfs off && test -f $cfs){
127 {/bin/cfs -s -f $cfs </srv/boot &} | echo 0 >/srv/cfs
129 mv /srv/cfs /srv/boot
133 # mount and change root in new enviroment and namespace
136 # mount root filesystem
139 must mount -c '#s/boot' /root $rootspec
141 # compile init command
150 # remove enviroment variables
151 rm -f '#e/'^$mt '#e/'? '#e/'?? '#e/fn#'*
153 # remove part of our temporary root
154 /mnt/broot/$cputype/bin/unmount /$cputype/bin /bin
155 /mnt/broot/$cputype/bin/unmount /rc/bin /bin
156 /mnt/broot/$cputype/bin/unmount /
158 # create the name space, mount the root fs
159 /mnt/broot/$cputype/bin/bind / /
160 /mnt/broot/$cputype/bin/bind -ac $rootdir /
162 # remove the remaining temporary root
163 /mnt/broot/$cputype/bin/unmount /mnt/broot
168 # keyboard and serial console
169 if(test -x /bin/aux/kbdfs){
173 aux/kbdfs -q -s cons $a
176 if(test -f /sys/lib/kbmap/$kbmap){
177 echo 'setting kbmap to' $kbmap
178 cat /sys/lib/kbmap/$kbmap >/dev/kbmap
184 if(test -x /bin/nusbrc && ! test -e /env/nousbrc)
190 for(i in /rc/lib/*.rc){
194 # add partitions and binds
200 # subshell doesnt wait on interrupts
201 while(~ $status interrupted){wait}
203 # cleanup so it can be restarted
205 rm -f /srv/^(cfs boot cs dns)