]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/cpurc
add cpu server to the installer; add more files for cpu server; make sure they are...
[plan9front.git] / rc / bin / cpurc
1 #!/bin/rc
2 # cpu server start up
3 date > /env/boottime
4
5 # mount points
6 mntgen -s slashn && chmod 666 /srv/slashn
7
8 # name translation, cs sets /dev/sysname
9 ndb/cs
10 sysname=`{cat /dev/sysname}
11
12 # parallelism for mk
13 NPROC = `{wc -l </dev/sysstat}
14
15 # site-specific startup
16 if(test -e /rc/bin/cpurc.local)
17         . /rc/bin/cpurc.local
18
19 if (~ $#sysname 0 || ~ $sysname '') {
20         sysname = helix                 # default
21         echo -n $sysname >/dev/sysname
22 }
23 prompt=($sysname^'# ' ' ')
24
25 # cpu-specific startup
26 if(test -e /cfg/$sysname/cpurc)
27         . /cfg/$sysname/cpurc
28
29 # start up internet if we don't already have an address
30 if(! grep u /net/ipselftab | grep -sv 127.0.0.1)
31         ip/ipconfig
32 if(! grep -s 127.0.0.1 /net/ipselftab)
33         ip/ipconfig loopback /dev/null 127.1
34
35 # if we're not a server, start a dns resolver
36 if(! test -e /srv/dns)
37         ndb/dns -r
38
39 # If you are on an auth server, start these before listening:
40 #
41 auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1]
42 auth/cron >>/sys/log/cron >[2=1] &
43 #
44 # also rename some files:
45 #
46 # if(! test -e /rc/bin/service.auth/tcp567){
47 #       mv /rc/bin/service.auth/authsrv.il566 /rc/bin/service.auth/il566
48 #       mv /rc/bin/service.auth/authsrv.tcp567 /rc/bin/service.auth/tcp567
49 #       mv /rc/bin/service/il566 /rc/bin/service/_il566
50 #       mv /rc/bin/service/tcp567 /rc/bin/service/_tcp567
51 # }
52
53 # start listeners if it hasn't already been done (dicey check)
54 if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
55         aux/listen -q tcp
56 # we don't use IL, maybe you do
57 if(! netstat -n | grep -v 17008 | grep -s il.*Listen)
58         aux/listen -q il
59
60 if(! ps|grep -s timesync) {
61         aux/timesync -n pool.ntp.org
62         if (test -e '#r/rtc') @ {
63                 sleep 10                        # let timesync correct the time
64                 awk '{print $1}' /dev/time >'#r/rtc'    # fix hw clock
65         } &
66 }
67
68 # cpu-specific late startup
69 if(test -e /cfg/$sysname/cpustart)
70         . /cfg/$sysname/cpustart
71
72 # mode of /proc/*/ctl is inherited across rfork, and sets modes on
73 # other /proc files, such as note, so let listen be killed.
74 dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$'
75
76 # echo `{date} $sysname >>/sys/log/boot
77 exit ''