From c9dc319649bd11aabbc3c235a0a9f94a70b4a452 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 9 Jun 2011 04:56:16 +0000 Subject: [PATCH] remove bootes, fix inst/authsetup, use ndb for ipconfig before trying dhcp --- adm/keys.who | 0 rc/bin/cpurc | 61 +++++++++++++++++---------------- rc/bin/inst/authsetup | 28 +++++++-------- rc/bin/inst/bootsetup | 1 - rc/bin/inst/mountcwfs | 32 ++++++++--------- rc/bin/termrc | 24 ++++++------- sys/lib/sysconfig/proto/cdproto | 20 +++-------- 7 files changed, 75 insertions(+), 91 deletions(-) delete mode 100644 adm/keys.who diff --git a/adm/keys.who b/adm/keys.who deleted file mode 100644 index e69de29bb..000000000 diff --git a/rc/bin/cpurc b/rc/bin/cpurc index f6bd2eb56..0c8c8beb1 100755 --- a/rc/bin/cpurc +++ b/rc/bin/cpurc @@ -19,8 +19,8 @@ sysname=`{cat /dev/sysname} # parallelism for mk NPROC = `{wc -l /dev/sysname } prompt=($sysname^'# ' ' ') @@ -29,37 +29,41 @@ prompt=($sysname^'# ' ' ') if(test -e /cfg/$sysname/cpurc) . /cfg/$sysname/cpurc -# start up internet if we don't already have an address -if(! grep u /net/ipselftab | grep -sv 127.0.0.1) - ip/ipconfig +# automatic ip address setup +if(! grep u /net/ipselftab | grep -sv 127.0.0.1){ + 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) ndb/dns -r -# If you are on an auth server, start these before listening: -# -auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1] -auth/cron >>/sys/log/cron >[2=1] & -# -# also rename some files: -# -# 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 -# } +if(! ps|grep -s timesync){ + if(~ $#ntp 0) + eval `{ndb/ipquery sys $sysname ntp} + if(~ $#ntp 0) + ntp=pool.ntp.org + aux/timesync -n $ntp + sleep 2 +} -# start listeners -aux/listen -q -t /rc/bin/service.auth -d /rc/bin/service tcp - -if(! ps|grep -s timesync) { - aux/timesync -n pool.ntp.org - if (test -e '#r/rtc') @ { - sleep 10 # let timesync correct the time - awk '{print $1}' /dev/time >'#r/rtc' # fix hw clock - } & +if(~ $#auth 0) + eval `{ndb/ipquery sys $sysname auth} +switch($auth){ +case `{ echo $sysname; ndb/query sys $sysname dom + for(i in `{awk '/u\ *$/{print $1}' /net/ipselftab}){ + echo $i; ndb/ipquery ip $i dom; ndb/ipquery ip $i sys + } | sed 's,[^ ]+=,,g'} + # 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 @@ -70,5 +74,4 @@ if(test -e /cfg/$sysname/cpustart) # other /proc files, such as note, so let listen be killed. dontkill '^(ipconfig|factotum|mntgen|venti|kfs|cwfs.*|cs|dns|reboot)$' -# echo `{date} $sysname >>/sys/log/boot exit '' diff --git a/rc/bin/inst/authsetup b/rc/bin/inst/authsetup index dc23e73b3..e4bea7dc3 100755 --- a/rc/bin/inst/authsetup +++ b/rc/bin/inst/authsetup @@ -1,36 +1,34 @@ #!/bin/rc -# desc: set system password for auth, invalidate nvram +# desc: invalidate nvram # prereq: systype copydist -nvram=`{echo `{basename -d $fs}^/nvram} +nvram=(/dev/sd*/nvram) +nvram=nvram(1) switch($1) { -case checkdone - if(! ~ $syst cpu || ! grep trust $nvram){ - authsetup=ready - export authsetup - } case go echo - echo 'Setup keyfs and provide a password for the machine' + echo 'Invalidate nvram' echo - auth/keyfs - - if(! grep trust $nvram) - echo 'trust, but verify' >$nvram >[2=1] + echo 'trust, but verify' >$nvram echo echo 'You will be asked to enter an authid, authdom, secstore key,' echo 'and password upon next boot. The authid is the hostowner.' echo 'The authdom is the domain from your network configuration.' echo 'The secstore key and password should be a secret password' - echo 'of eight characters or greater in length. Remember the' - echo 'password, you will need to use it again when creating the' - echo 'bootes user on the auth server.' + echo 'of eight characters or greater in length. On an auth server,' + echo 'the password will be used to encrypt the user database' + echo '/adm/keys' echo authsetup=done export authsetup +case checkdone + if(~ $syst cpu && test -w $nvram && ! grep -s trust $nvram){ + authsetup=ready + export authsetup + } } diff --git a/rc/bin/inst/bootsetup b/rc/bin/inst/bootsetup index cbd472df7..08448f516 100755 --- a/rc/bin/inst/bootsetup +++ b/rc/bin/inst/bootsetup @@ -25,7 +25,6 @@ case go { echo 'bootfile='^$bootfile echo 'bootargs=local!'^$fs - echo 'sysname=cirno' echo 'mouseport='^$mouseport echo 'monitor='^$monitor echo 'vgasize='^$vgasize diff --git a/rc/bin/inst/mountcwfs b/rc/bin/inst/mountcwfs index 2c1416f3a..3a917b7bc 100755 --- a/rc/bin/inst/mountcwfs +++ b/rc/bin/inst/mountcwfs @@ -3,6 +3,8 @@ # desc: choose and mount file system partition # prereq: systype +service=cwfs + switch($1){ case go echo @@ -53,13 +55,13 @@ case go log Starting $fstype file server for $fs unmount /n/newfs >[2]/dev/null - echo halt >>/srv/cwfs.cmd >[2]/dev/null - rm -f /srv/cwfs /srv/cwfs.cmd + echo halt >>/srv/$service.cmd >[2]/dev/null + rm -f /srv/$service /srv/$service.cmd if(~ $ream yes){ if(! test -f /tmp/fsconfig){ { - echo service cwfs + echo service $service echo config $fs if(! ~ $syst cpu){ @@ -86,7 +88,7 @@ case go } if not { 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 export mountfs exit oops @@ -95,6 +97,7 @@ case go log Configuering $fstype file server for $fs { + echo noattach echo allow echo users default echo cfs main @@ -102,9 +105,6 @@ case go echo create /adm/users adm adm 664 echo create /dist 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 adm +$user echo newuser sys +$user @@ -113,30 +113,26 @@ case go echo cfs other echo create /dist 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/tmp $user $user 750 d echo cfs main } - } >>/srv/cwfs.cmd - sleep 5 + echo noattach + sleep 2 + } >>/srv/$service.cmd log Mounting $fstype file server for $fs - if(! logprog mount -c /srv/cwfs /n/newfs){ - mountfs=ready - export mountfs - exit - } + while(! logprog mount -c /srv/$service /n/newfs) + sleep 2 if(! ~ $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 } case checkready checkdone 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 export mountfs exit diff --git a/rc/bin/termrc b/rc/bin/termrc index 8444bfb78..e30809719 100755 --- a/rc/bin/termrc +++ b/rc/bin/termrc @@ -36,19 +36,17 @@ NPROC = `{wc -l