remove bootes, fix inst/authsetup, use ndb for ipconfig before trying dhcp

This commit is contained in:
cinap_lenrek 2011-06-09 04:56:16 +00:00
parent 0fff50776c
commit c9dc319649
7 changed files with 75 additions and 91 deletions

View file

View file

@ -19,8 +19,8 @@ sysname=`{cat /dev/sysname}
# parallelism for mk # parallelism for mk
NPROC = `{wc -l </dev/sysstat} NPROC = `{wc -l </dev/sysstat}
if (~ $#sysname 0 || ~ $sysname '') { if (~ $#sysname 0 || ~ $sysname ''){
sysname = cirno # default sysname=cirno # default
echo -n $sysname >/dev/sysname echo -n $sysname >/dev/sysname
} }
prompt=($sysname^'# ' ' ') prompt=($sysname^'# ' ' ')
@ -29,37 +29,41 @@ prompt=($sysname^'# ' ' ')
if(test -e /cfg/$sysname/cpurc) if(test -e /cfg/$sysname/cpurc)
. /cfg/$sysname/cpurc . /cfg/$sysname/cpurc
# start up internet if we don't already have an address # automatic ip address setup
if(! grep u /net/ipselftab | grep -sv 127.0.0.1) if(! grep u /net/ipselftab | grep -sv 127.0.0.1){
ip/ipconfig ether=`{ndb/query sys $sysname ether}
if(~ $#ether 1){
# try /lib/ndb first, then do dhcp
ip/ipconfig -N || ip/ipconfig
}
rm -f /env/ether
}
# if we're not a server, start a dns resolver
if(! test -e /srv/dns) if(! test -e /srv/dns)
ndb/dns -r ndb/dns -r
# If you are on an auth server, start these before listening: if(! ps|grep -s timesync){
# if(~ $#ntp 0)
auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1] eval `{ndb/ipquery sys $sysname ntp}
auth/cron >>/sys/log/cron >[2=1] & if(~ $#ntp 0)
# ntp=pool.ntp.org
# also rename some files: aux/timesync -n $ntp
# sleep 2
# if(! test -e /rc/bin/service.auth/tcp567){ }
# mv /rc/bin/service.auth/authsrv.il566 /rc/bin/service.auth/il566
# mv /rc/bin/service.auth/authsrv.tcp567 /rc/bin/service.auth/tcp567
# mv /rc/bin/service/il566 /rc/bin/service/_il566
# mv /rc/bin/service/tcp567 /rc/bin/service/_tcp567
# }
# start listeners if(~ $#auth 0)
aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service tcp eval `{ndb/ipquery sys $sysname auth}
switch($auth){
if(! ps|grep -s timesync) { case `{ echo $sysname; ndb/query sys $sysname dom
aux/timesync -n pool.ntp.org for(i in `{awk '/u\ *$/{print $1}' /net/ipselftab}){
if (test -e '#r/rtc') @ { echo $i; ndb/ipquery ip $i dom; ndb/ipquery ip $i sys
sleep 10 # let timesync correct the time } | sed 's,[^ ]+=,,g'}
awk '{print $1}' /dev/time >'#r/rtc' # fix hw clock # cpu+auth server
} & auth/keyfs -wp -m /mnt/keys /adm/keys
aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service tcp
case *
# cpu server
aux/listen -q -d /rc/bin/service tcp
} }
# cpu-specific late startup # cpu-specific late startup
@ -70,5 +74,4 @@ if(test -e /cfg/$sysname/cpustart)
# other /proc files, such as note, so let listen be killed. # other /proc files, such as note, so let listen be killed.
dontkill '^(ipconfig|factotum|mntgen|venti|kfs|cwfs.*|cs|dns|reboot)$' dontkill '^(ipconfig|factotum|mntgen|venti|kfs|cwfs.*|cs|dns|reboot)$'
# echo `{date} $sysname >>/sys/log/boot
exit '' exit ''

View file

@ -1,36 +1,34 @@
#!/bin/rc #!/bin/rc
# desc: set system password for auth, invalidate nvram # desc: invalidate nvram
# prereq: systype copydist # prereq: systype copydist
nvram=`{echo `{basename -d $fs}^/nvram} nvram=(/dev/sd*/nvram)
nvram=nvram(1)
switch($1) { switch($1) {
case checkdone
if(! ~ $syst cpu || ! grep trust $nvram){
authsetup=ready
export authsetup
}
case go case go
echo echo
echo 'Setup keyfs and provide a password for the machine' echo 'Invalidate nvram'
echo echo
auth/keyfs echo 'trust, but verify' >$nvram
if(! grep trust $nvram)
echo 'trust, but verify' >$nvram >[2=1]
echo echo
echo 'You will be asked to enter an authid, authdom, secstore key,' echo 'You will be asked to enter an authid, authdom, secstore key,'
echo 'and password upon next boot. The authid is the hostowner.' echo 'and password upon next boot. The authid is the hostowner.'
echo 'The authdom is the domain from your network configuration.' echo 'The authdom is the domain from your network configuration.'
echo 'The secstore key and password should be a secret password' echo 'The secstore key and password should be a secret password'
echo 'of eight characters or greater in length. Remember the' echo 'of eight characters or greater in length. On an auth server,'
echo 'password, you will need to use it again when creating the' echo 'the password will be used to encrypt the user database'
echo 'bootes user on the auth server.' echo '/adm/keys'
echo echo
authsetup=done authsetup=done
export authsetup export authsetup
case checkdone
if(~ $syst cpu && test -w $nvram && ! grep -s trust $nvram){
authsetup=ready
export authsetup
}
} }

View file

@ -25,7 +25,6 @@ case go
{ {
echo 'bootfile='^$bootfile echo 'bootfile='^$bootfile
echo 'bootargs=local!'^$fs echo 'bootargs=local!'^$fs
echo 'sysname=cirno'
echo 'mouseport='^$mouseport echo 'mouseport='^$mouseport
echo 'monitor='^$monitor echo 'monitor='^$monitor
echo 'vgasize='^$vgasize echo 'vgasize='^$vgasize

View file

@ -3,6 +3,8 @@
# desc: choose and mount file system partition # desc: choose and mount file system partition
# prereq: systype # prereq: systype
service=cwfs
switch($1){ switch($1){
case go case go
echo echo
@ -53,13 +55,13 @@ case go
log Starting $fstype file server for $fs log Starting $fstype file server for $fs
unmount /n/newfs >[2]/dev/null unmount /n/newfs >[2]/dev/null
echo halt >>/srv/cwfs.cmd >[2]/dev/null echo halt >>/srv/$service.cmd >[2]/dev/null
rm -f /srv/cwfs /srv/cwfs.cmd rm -f /srv/$service /srv/$service.cmd
if(~ $ream yes){ if(~ $ream yes){
if(! test -f /tmp/fsconfig){ if(! test -f /tmp/fsconfig){
{ {
echo service cwfs echo service $service
echo config $fs echo config $fs
if(! ~ $syst cpu){ if(! ~ $syst cpu){
@ -86,7 +88,7 @@ case go
} }
if not { if not {
echo 'Entering manual configuration mode. when done, type end' echo 'Entering manual configuration mode. when done, type end'
if(! $fstype -n cwfs -f $fs -c){ if(! $fstype -n $service -f $fs -c){
mountfs=ready mountfs=ready
export mountfs export mountfs
exit oops exit oops
@ -95,6 +97,7 @@ case go
log Configuering $fstype file server for $fs log Configuering $fstype file server for $fs
{ {
echo noattach
echo allow echo allow
echo users default echo users default
echo cfs main echo cfs main
@ -102,9 +105,6 @@ case go
echo create /adm/users adm adm 664 echo create /adm/users adm adm 664
echo create /dist sys sys 775 d echo create /dist sys sys 775 d
echo create /usr sys sys 775 d echo create /usr sys sys 775 d
echo newuser adm +bootes
echo newuser sys +bootes
echo newuser upas +bootes
echo newuser $user echo newuser $user
echo newuser adm +$user echo newuser adm +$user
echo newuser sys +$user echo newuser sys +$user
@ -113,30 +113,26 @@ case go
echo cfs other echo cfs other
echo create /dist sys sys 775 d echo create /dist sys sys 775 d
echo create /usr sys sys 775 d echo create /usr sys sys 775 d
echo create /usr/bootes bootes bootes 775 d
echo create /usr/bootes/tmp bootes bootes 750 d
echo create /usr/$user $user $user 775 d echo create /usr/$user $user $user 775 d
echo create /usr/$user/tmp $user $user 750 d echo create /usr/$user/tmp $user $user 750 d
echo cfs main echo cfs main
} }
} >>/srv/cwfs.cmd echo noattach
sleep 5 sleep 2
} >>/srv/$service.cmd
log Mounting $fstype file server for $fs log Mounting $fstype file server for $fs
if(! logprog mount -c /srv/cwfs /n/newfs){ while(! logprog mount -c /srv/$service /n/newfs)
mountfs=ready sleep 2
export mountfs
exit
}
if(! ~ $fsother ''){ if(! ~ $fsother ''){
log Mounting $fstype file server for $fsother log Mounting $fstype file server for $fsother
if(logprog mount -c /srv/cwfs /n/other other) if(logprog mount -c /srv/$service /n/other other)
bind -qc /n/other/dist /n/newfs/dist bind -qc /n/other/dist /n/newfs/dist
} }
case checkready checkdone case checkready checkdone
if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){ if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
if(test -f /srv/cwfs && test -d /n/newfs/dist){ if(test -f /srv/$service && test -d /n/newfs/dist){
mountfs=done mountfs=done
export mountfs export mountfs
exit exit

View file

@ -36,19 +36,17 @@ NPROC = `{wc -l </dev/sysstat}
if(test -e /cfg/$sysname/termrc) if(test -e /cfg/$sysname/termrc)
. /cfg/$sysname/termrc . /cfg/$sysname/termrc
# start IP on the LAN, if not already configured. diskless terminals # automatic ip address setup
# are already configured by now. It's commented out to avoid a long timeout if(! grep u /net/ipselftab | grep -sv 127.0.0.1){
# on startup waiting for DHCP. ether=`{ndb/query sys $sysname ether}
# if(~ $#ether 1){
# If your site provides DHCP service, # try /lib/ndb first, then do dhcp
# ip/ipconfig -N || ip/ipconfig
#if(! test -e /net/ipifc/0/ctl) }
# ip/ipconfig rm -f /env/ether
# }
# Otherwise, see /cfg/$sysname/termrc (/cfg/example/termrc is an example).
# start dns if we have an internet if(! test -e /srv/dns)
if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)
ndb/dns -r ndb/dns -r
if(! ~ $terminal *vx32*){ if(! ~ $terminal *vx32*){
@ -100,7 +98,7 @@ if(! ~ $"vgasize '' text none){
} }
rm -f '/env/fn#ask' rm -f '/env/fn#ask'
if (test -f /dev/apm) if(test -f /dev/apm)
aux/apm aux/apm
dontkill '^(ipconfig|factotum|mntgen|kfs|cwfs.*|cs|dns|listen|reboot)$' dontkill '^(ipconfig|factotum|mntgen|kfs|cwfs.*|cs|dns|listen|reboot)$'

View file

@ -19,8 +19,6 @@ mail d775 upas upas
uid=upas uid=upas
gid=upas gid=upas
box d775 box d775
bootes d775 bootes bootes
mbox a662 bootes bootes /sys/lib/dist/empty
glenda d775 glenda glenda glenda d775 glenda glenda
mbox a662 glenda glenda /sys/lib/dist/empty mbox a662 glenda glenda /sys/lib/dist/empty
faxoutqueue d775 faxoutqueue d775
@ -94,6 +92,7 @@ sys d775
+ +
log d775 log d775
auth a662 sys sys /sys/lib/dist/empty auth a662 sys sys /sys/lib/dist/empty
boot a662 sys sys /sys/lib/dist/empty
cpu a662 sys sys /sys/lib/dist/empty cpu a662 sys sys /sys/lib/dist/empty
cron a662 sys sys /sys/lib/dist/empty cron a662 sys sys /sys/lib/dist/empty
cs a662 sys sys /sys/lib/dist/empty cs a662 sys sys /sys/lib/dist/empty
@ -104,14 +103,15 @@ sys d775
httpd a662 sys sys /sys/lib/dist/empty httpd a662 sys sys /sys/lib/dist/empty
imap4d a662 sys sys /sys/lib/dist/empty imap4d a662 sys sys /sys/lib/dist/empty
ipboot a662 sys sys /sys/lib/dist/empty ipboot a662 sys sys /sys/lib/dist/empty
ipboot a662 sys sys /sys/lib/dist/empty
listen a662 sys sys /sys/lib/dist/empty listen a662 sys sys /sys/lib/dist/empty
mail a662 sys sys /sys/lib/dist/empty mail a662 sys sys /sys/lib/dist/empty
runq a662 sys sys /sys/lib/dist/empty
smtp a662 sys sys /sys/lib/dist/empty smtp a662 sys sys /sys/lib/dist/empty
smtp.fail a662 sys sys /sys/lib/dist/empty smtp.fail a662 sys sys /sys/lib/dist/empty
smtpd a662 sys sys /sys/lib/dist/empty smtpd a662 sys sys /sys/lib/dist/empty
smtpd.mx a662 sys sys /sys/lib/dist/empty smtpd.mx a662 sys sys /sys/lib/dist/empty
runq a662 sys sys /sys/lib/dist/empty
secstore a662 sys sys /sys/lib/dist/empty secstore a662 sys sys /sys/lib/dist/empty
timesync a662 sys sys /sys/lib/dist/empty timesync a662 sys sys /sys/lib/dist/empty
@ -121,20 +121,10 @@ sys d775
src d775 src d775
skip=\.[ao]?[12578vqki]?$ skip=\.[ao]?[12578vqki]?$
+ +
tmp d555 tmp d555
usr d775 usr d775
bootes d775 bootes bootes
uid=bootes
gid=bootes
bin d775
386 d775
+
rc d775
+
lib d775
*
tmp d775
glenda d775 glenda glenda glenda d775 glenda glenda
uid=glenda uid=glenda
gid=glenda gid=glenda