From 0461c5843310c5c51bf43b0835f180492e32f579 Mon Sep 17 00:00:00 2001 From: stanley lieber Date: Wed, 4 May 2011 18:55:08 +0000 Subject: [PATCH] add cpu server to the installer; add more files for cpu server; make sure they are included on the cd-rom. --- cfg/cirno/cpurc | 1 + cfg/cirno/termrc | 1 + lib/ndb/local | 15 +++++++++++++ rc/bin/cpurc | 4 ++-- rc/bin/cpurc.local | 3 +++ rc/bin/inst/authsetup | 36 ++++++++++++++++++++++++++++++ rc/bin/inst/bootsetup | 10 +++++++-- rc/bin/inst/main | 2 ++ rc/bin/inst/mountcwfs | 18 ++++++++++----- rc/bin/inst/systype | 23 +++++++++++++++++++ sys/lib/sysconfig/proto/cdproto | 19 +++++++++++++++- usr/bootes/lib/newstime | 0 usr/bootes/lib/plumbing | 6 +++++ usr/bootes/lib/profile | 39 +++++++++++++++++++++++++++++++++ 14 files changed, 167 insertions(+), 10 deletions(-) create mode 100755 rc/bin/inst/authsetup mode change 100644 => 100755 rc/bin/inst/mountcwfs create mode 100755 rc/bin/inst/systype create mode 100644 usr/bootes/lib/newstime create mode 100644 usr/bootes/lib/plumbing create mode 100644 usr/bootes/lib/profile diff --git a/cfg/cirno/cpurc b/cfg/cirno/cpurc index d91dba6ff..92e646d75 100755 --- a/cfg/cirno/cpurc +++ b/cfg/cirno/cpurc @@ -7,6 +7,7 @@ # example: adjust to fit your network ip/ipconfig -g 192.168.0.1 ether /net/ether0 192.168.0.2 255.255.255.0 +ndb/dns -rs # outgoing mail will appear to originate from this domain site=9front diff --git a/cfg/cirno/termrc b/cfg/cirno/termrc index 3d18e28f1..7c4cb7dd0 100644 --- a/cfg/cirno/termrc +++ b/cfg/cirno/termrc @@ -1,5 +1,6 @@ # example: adjust to fit your network ip/ipconfig -g 192.168.0.1 ether /net/ether0 192.168.0.2 255.255.255.0 +ndb/dns -r # outgoing mail will appear to originate from this domain site=9front diff --git a/lib/ndb/local b/lib/ndb/local index 590d9f60b..489a06268 100755 --- a/lib/ndb/local +++ b/lib/ndb/local @@ -8,7 +8,22 @@ database= auth=sources.cs.bell-labs.com authdom=outside.plan9.bell-labs.com +auth=cirno.9front authdom=9front + +ntp=pool.ntp.org + # # because the public demands the name localsource # ip=127.0.0.1 sys=localhost dom=localhost + +# example: adjust to fit your network +ipnet=9front ip=192.168.0.0 ipmask=255.255.255.0 + auth=cirno.9front + cpu=cirno.9front + dns=192.168.0.2 + dnsdom=9front + smtp=cirno.9front + +ip=192.168.0.1 sys=gw dom=gw.9front +ip=192.168.0.2 sys=cirno dom=cirno.9front diff --git a/rc/bin/cpurc b/rc/bin/cpurc index dbcebc355..20ca6382a 100755 --- a/rc/bin/cpurc +++ b/rc/bin/cpurc @@ -38,8 +38,8 @@ if(! test -e /srv/dns) # 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] & +auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1] +auth/cron >>/sys/log/cron >[2=1] & # # also rename some files: # diff --git a/rc/bin/cpurc.local b/rc/bin/cpurc.local index 6d62b5dc6..1a5a45d3e 100755 --- a/rc/bin/cpurc.local +++ b/rc/bin/cpurc.local @@ -9,3 +9,6 @@ site=EXAMPLE fileserver=kfs # replace FACEDOM with the local domain to be used in the faces database facedom=FACEDOM + +for(i in m i P S t) + bind -a '#'^$i /dev >/dev/null >[2=1] diff --git a/rc/bin/inst/authsetup b/rc/bin/inst/authsetup new file mode 100755 index 000000000..dc23e73b3 --- /dev/null +++ b/rc/bin/inst/authsetup @@ -0,0 +1,36 @@ +#!/bin/rc + +# desc: set system password for auth, invalidate nvram +# prereq: systype copydist + +nvram=`{echo `{basename -d $fs}^/nvram} + +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 + + auth/keyfs + + if(! grep trust $nvram) + echo 'trust, but verify' >$nvram >[2=1] + + 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 + + authsetup=done + export authsetup +} diff --git a/rc/bin/inst/bootsetup b/rc/bin/inst/bootsetup index 9e5c71d46..7de697850 100755 --- a/rc/bin/inst/bootsetup +++ b/rc/bin/inst/bootsetup @@ -1,7 +1,7 @@ #!/bin/rc # desc: create a boot floppy or configure hard disk to boot plan 9 -# prereq: copydist +# prereq: systype copydist switch($1) { case go @@ -18,9 +18,14 @@ case go } if(! test -f /tmp/plan9.ini) { + if(~ $syst cpu) + bootfile=9pccpuf + if not + bootfile=9pcf { - echo 'bootfile=9pcf' + echo 'bootfile='^$bootfile echo 'bootargs=local!'^$fs + echo 'sysname=cirno' echo 'mouseport='^$mouseport echo 'monitor='^$monitor echo 'vgasize='^$vgasize @@ -47,6 +52,7 @@ case go logprog cp /tmp/plan9.ini /n/9fat/plan9.ini logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat logprog cp /n/newfs/386/9pcf /n/9fat/9pcf + logprog cp /n/newfs/386/9pccpuf /n/9fat/9pccpuf echo echo 'There are myriad ways to boot a Plan 9 system.' diff --git a/rc/bin/inst/main b/rc/bin/inst/main index ce09cc2d7..bd974658b 100755 --- a/rc/bin/inst/main +++ b/rc/bin/inst/main @@ -12,6 +12,7 @@ echo -n 'Preparing menu...' # must be topologically sorted (by prereq) tasks=(\ + systype\ configfs\ partdisk prepdisk\ mountfs\ @@ -20,6 +21,7 @@ tasks=(\ mountdist\ download\ copydist\ + authsetup\ bootsetup finish stop\ stopether stopppp\ ) diff --git a/rc/bin/inst/mountcwfs b/rc/bin/inst/mountcwfs old mode 100644 new mode 100755 index 3af4486d4..2c1416f3a --- a/rc/bin/inst/mountcwfs +++ b/rc/bin/inst/mountcwfs @@ -1,6 +1,7 @@ #!/bin/rc # desc: choose and mount file system partition +# prereq: systype switch($1){ case go @@ -61,8 +62,10 @@ case go echo service cwfs echo config $fs - # new config option - echo noauth + if(! ~ $syst cpu){ + # new config option + echo noauth + } echo filsys main c'('$fs')('$fsworm')' echo filsys dump o @@ -97,18 +100,23 @@ case go echo cfs main echo create /adm adm adm 775 d echo create /adm/users adm adm 664 - echo create /usr sys sys 775 d 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 sys +$user echo newuser adm +$user + echo newuser sys +$user echo newuser upas +$user if(! ~ $fsother ''){ 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 create /dist sys sys 775 d echo cfs main } } >>/srv/cwfs.cmd diff --git a/rc/bin/inst/systype b/rc/bin/inst/systype new file mode 100755 index 000000000..ab4e53a25 --- /dev/null +++ b/rc/bin/inst/systype @@ -0,0 +1,23 @@ +#!/bin/rc + +# desc: choose system type + +switch($1){ +case checkdone + if(~ $#syst 1 && ~ $syst cpu terminal) + systype=done + if not + systype=ready + export systype + if(~ $syst terminal) + tasks=`{echo $tasks | sed 's/authsetup//g'} + export tasks +case go + echo + + options=(terminal cpu) + + prompt -d terminal 'System type' $options + syst=$rd + export syst +} diff --git a/sys/lib/sysconfig/proto/cdproto b/sys/lib/sysconfig/proto/cdproto index 5fdcc67b0..dc4a55864 100644 --- a/sys/lib/sysconfig/proto/cdproto +++ b/sys/lib/sysconfig/proto/cdproto @@ -3,10 +3,13 @@ gid=sys adm d775 adm adm uid=adm gid=adm + keys.who 665 timezone d775 * cfg d775 + +cron d777 sys sys + bootes d775 bootes bootes fd d775 lib d775 + @@ -16,6 +19,8 @@ mail d775 upas upas uid=upas gid=upas box d775 + bootes d775 bootes bootes + mbox a662 bootes bootes glenda d775 glenda glenda mbox a662 glenda glenda faxoutqueue d777 @@ -88,7 +93,8 @@ sys d775 lib d775 skip=\.(pyo|pyc)$ + - log d775 + log d777 sys sys + cron a664 bootes bootes man d775 + src d775 @@ -97,6 +103,17 @@ sys d775 tmp d555 usr d775 + bootes d775 bootes bootes + uid=bootes + gid=bootes + bin d775 + 386 d775 + + + rc d775 + + + lib d775 + * + tmp d775 glenda d775 glenda glenda uid=glenda gid=glenda diff --git a/usr/bootes/lib/newstime b/usr/bootes/lib/newstime new file mode 100644 index 000000000..e69de29bb diff --git a/usr/bootes/lib/plumbing b/usr/bootes/lib/plumbing new file mode 100644 index 000000000..ec82918a2 --- /dev/null +++ b/usr/bootes/lib/plumbing @@ -0,0 +1,6 @@ +# to update: cp /usr/bootes/lib/plumbing /mnt/plumb/rules + +editor = acme + +include basic + diff --git a/usr/bootes/lib/profile b/usr/bootes/lib/profile new file mode 100644 index 000000000..967865113 --- /dev/null +++ b/usr/bootes/lib/profile @@ -0,0 +1,39 @@ +bind -a $home/bin/rc /bin +bind -a $home/bin/$cputype /bin +bind -c $home/tmp /tmp +font = /lib/font/bit/pelm/euro.9.font +switch($service){ +case terminal + plumber + startupasfs + echo -n accelerated > '#m/mousectl' + echo -n 'res 3' > '#m/mousectl' + prompt=('term% ' ' ') + fn term%{ $* } + exec rio +case cpu + if (test -e /mnt/term/mnt/wsys) { + # rio already running + wsys = /mnt/term^`{cat /mnt/term/env/wsys} + bind -a /mnt/term/mnt/wsys /dev + echo -n $sysname > /dev/label + } + bind /mnt/term/dev/cons /dev/cons + bind /mnt/term/dev/consctl /dev/consctl + bind -a /mnt/term/dev /dev + prompt=('cpu% ' ' ') + fn cpu%{ $* } + startupasfs + news + if (! test -e /mnt/term/mnt/wsys) { + # cpu call from drawterm + font=/lib/font/bit/pelm/latin1.8.font + plumber + auth/factotum + exec rio + } +case con + prompt=('cpu% ' ' ') + startupasfs + news +}