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
13 for(i in ¶ P S f æ t b m)
16 # bind in an ip interface
17 for(i in I l^(0 1 2 3))
20 # usually better than 1970
21 cat '#r/rtc' >/dev/time >[2]/dev/null
24 for(i in `{ls -Qp /env}){
26 case '*'* 'fn#'* e820 apm0 apid ifs path pid prompt status ?
43 $* || fatal $"*^': '^$status
54 $1=`{dd -bs 64 -count 1 >[2]/dev/null}
70 if(~ $#nobootprompt 0){
73 ask bootargs ' is (tcp, tls, il, local!device)' $"bootargs
75 if not bootargs=$nobootprompt
77 mn=`{echo $bootargs | sed 's,!, ,'}
87 # authentication agent
88 if(! test -f /srv/factotum){
89 # we remount ip inteface after hostowner is set
90 unmount '#I' /net >[2]/dev/null
92 x=(/boot/factotum -n -sfactotum)
97 if(! ~ $#debugfactotum 0)
107 # load keys from secstore if $auth or $secstore is not empty
110 if(! ~ $#$x 0 && test -x /bin/auth/secstore && test -f /mnt/factotum/ctl){
111 x=(auth/secstore -G factotum -s^$$x)
113 $x -n >/mnt/factotum/ctl
114 if(~ $status *readnvram* || ! ~ $service cpu)
115 $x >/mnt/factotum/ctl
121 # insert cfs in the pipeline
122 if(test -x /bin/cfs){
123 if(~ $#bootdisk 1 && ~ $#cfs 0)
125 if(~ $#cfs 1 && ! ~ $cfs off && test -f $cfs){
126 {/bin/cfs -s -f $cfs </srv/boot &} | echo 0 >/srv/cfs
128 mv /srv/cfs /srv/boot
132 # mount and change root in new enviroment and namespace
135 # mount root filesystem
138 must mount -c '#s/boot' /root $rootspec
140 # compile init command
149 # remove enviroment variables
150 rm -f '#e/'^$mt '#e/'? '#e/'?? '#e/fn#'*
152 # remove part of our temporary root
153 /mnt/broot/$cputype/bin/unmount /$cputype/bin /bin
154 /mnt/broot/$cputype/bin/unmount /rc/bin /bin
155 /mnt/broot/$cputype/bin/unmount /
157 # create the name space, mount the root fs
158 /mnt/broot/$cputype/bin/bind / /
159 /mnt/broot/$cputype/bin/bind -ac $rootdir /
161 # remove the remaining temporary root
162 /mnt/broot/$cputype/bin/unmount /mnt/broot
167 # keyboard and serial console
168 if(test -x /bin/aux/kbdfs){
172 aux/kbdfs -q -s cons $a
175 if(test -f /sys/lib/kbmap/$kbmap){
176 echo 'setting kbmap to' $kbmap
177 cat /sys/lib/kbmap/$kbmap >/dev/kbmap
183 if(test -x /bin/nusbrc && ! test -e /env/nousbrc)
189 for(i in /rc/lib/*.rc){
193 # add partitions and binds
199 # subshell doesnt wait on interrupts
200 while(~ $status interrupted){wait}
202 # cleanup so it can be restarted
204 rm -f /srv/^(cfs boot cs dns)