From bb58ca33aae4df29f4916e404b79492df5f83fbe Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Tue, 29 Nov 2016 23:13:24 +0100 Subject: [PATCH] Revert "cfg/startup: start as terminal" This reverts commit 0117b7d6b22b795e5d130ba3bdf3735f867d672e. --- cfg/startup | 157 +++++++++++++++++++++------------------------------- 1 file changed, 64 insertions(+), 93 deletions(-) diff --git a/cfg/startup b/cfg/startup index 9c25956..4ed0424 100755 --- a/cfg/startup +++ b/cfg/startup @@ -1,116 +1,87 @@ #!/cmd/rc -# terminal startup -TIMESYNCARGS=(-rLa1000000) -NDBFILE=/cfg/ndb/local +# cpu server start up +date > /env/boottime +# mount points mntgen -s slashn && chmod 666 /srv/slashn -# bind all likely devices (#S was bound in boot) -for(i in f t m v L P u U '$' Σ κ) - /cmd/bind -a '#'^$i /dev >/dev/null >[2=1] -rm -f /env/i - -# set up any partitions -diskparts - -# start up local swapping -disk=`{ls /dev/sd*/swap >[2]/dev/null} -if (! ~ $#disk 0) - swap $disk(1) >/dev/null >[2=1] -rm /env/disk - -# we do this before we have a name. we may need to do network -# setup so that we can get a name. -if(test -e /arch/rc/cmd/termrc.local) - . /arch/rc/cmd/termrc.local - -# cs sets sysname (termrc.local may already have started it so check) -if(! test -e /srv/cs && ! test -e /net/cs) - ndb/cs -f $NDBFILE +# name translation, cs sets /dev/sysname +ndb/cs sysname=`{cat /dev/sysname} + +# parallelism for mk +NPROC = `{wc -l /dev/sysname } +prompt=($sysname^'# ' ' ') -# machine specific startup (e.g., for devices not probed) -if(test -e /cfg/$sysname/termrc) - . /cfg/$sysname/termrc +# cpu-specific startup +if(test -e /cfg/$sysname/cpurc) + . /cfg/$sysname/cpurc -# start IP on the LAN, if not already configured. diskless terminals -# are already configured by now. It's commented out to avoid a long timeout -# on startup waiting for DHCP. -# -# If your site provides DHCP service, -# -#if(! test -e /net/ipifc/0/ctl) -# ip/ipconfig -# -# Otherwise, see /cfg/$sysname/termrc (/cfg/example/termrc is an example). +# start up internet if we don't already have an address +if(! grep u /net/ipselftab | grep -sv 127.0.0.1) + ip/ipconfig +if(! grep -s 127.0.0.1 /net/ipselftab) + ip/ipconfig loopback /dev/null 127.1 -# start dns if we have an internet -if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns) +# if we're not a server, start a dns resolver +if(! test -e /srv/dns) ndb/dns -r -if(! ~ $terminal *vx32*){ - # start timesync if it isn't running and we weren't told not to - if(! ps|grep -s timesync) - if(! ~ $TIMESYNCARGS '') - ip/timesync $TIMESYNCARGS +# 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] & - # add the loop-back medium - if(! grep -s 127.0.0.1 /net/ipselftab) - ip/ipconfig loopback /dev/null 127.1 +# keep other bootes processes from creating capabilities +rm -f '#¤/caphash' - # set things up for vmware - if(! ~ `{cat /dev/user} none) - if(test -e /cmd/aux/vmware) - aux/vmware -} +# also rename some files on an auth server: +# +# if(! test -e /arch/rc/cmd/service.auth/tcp567){ +# mv /arch/rc/cmd/service.auth/authsrv.il566 /arch/rc/cmd/service.auth/il566 +# mv /arch/rc/cmd/service.auth/authsrv.tcp567 /arch/rc/cmd/service.auth/tcp567 +# mv /arch/rc/cmd/service/il566 /arch/rc/cmd/service/_il566 +# mv /arch/rc/cmd/service/tcp567 /arch/rc/cmd/service/_tcp567 +# } -# query user if terminal isn't adequately configured yet -if(~ $mouseport ask){ - echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: ' - mouseport=`{read} -} -if(~ $#mouseport 0) - mouseport=ps2 +# netssh -if(~ $vgasize ask){ - echo -n 'vgasize [1024x768x8]: ' - vgasize=`{read} -} -if(~ $#vgasize 0) - vgasize=1024x768x8 +# start listeners if it hasn't already been done (dicey check) +if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*') + ip/listen -q tcp -if(~ $monitor ask){ - echo -n 'monitor is [vesa]: ' - monitor=`{read} -} -if(~ $#monitor 0) - monitor=vesa +# TODO: Removed until awk works +#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(test -f /dev/mousectl){ - switch($mouseport){ - case ps2 ps2intellimouse 0 1 2 - hmi/mouse $mouseport - ms & - # parse vgasize into fields - vgasize=`{echo $vgasize} - if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none) { - hmi/realemu - hmi/vga -m $monitor -l $vgasize - } - if(~ $accupoint 1) - pipefile -dr /cmd/aux/accupoint /dev/mouse - rio -i /lib/riostart - } -} +# cpu-specific late startup +if(test -e /cfg/$sysname/cpustart) + . /cfg/$sysname/cpustart -# usb listener -/arch/rc/aux/usb/usbrc +# mode of /proc/*/ctl is inherited across rfork, and sets modes on +# other /proc files, such as note, so let listen be killed. +#dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$' -if (test -f /dev/apm) - aux/apm +ip/listen1 -t -v tcp!*!1522 /cmd/hmi/pipeconsole /cmd/rc -m /arch/rc/lib/rcmain -i & +if(test ! -e '#s/comconsole') + hmi/comconsole '#t/eia0' /cmd/rc -m/arch/rc/lib/rcmain -i & -dontkill '^(ipconfig|factotum|mntgen|fossil|cs|dns|listen|reboot)$' +echo 'key proto=p9sk1 dom=jehanne user=glenda !password=demodemo' >/mnt/factotum/ctl +ip/listen1 -t tcp!*!17010 /cmd/cpu -R & + +# echo `{date} $sysname >>/sys/log/boot +exit ''