]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/termrc
merge
[plan9front.git] / rc / bin / termrc
1 #!/bin/rc
2 # the 9pcf kernel runs this file
3
4 TIMESYNCARGS=(-rLa1000000)
5 NDBFILE=/lib/ndb/local
6
7 mntgen -s slashn && chmod 666 /srv/slashn
8
9 # bind all likely devices
10 for(i in S f k t m i v L P u U '$' Σ κ)
11         bind -a '#'^$i /dev >/dev/null >[2=1]
12 rm -f /env/i
13
14 mount -qa /srv/usb /dev
15
16 # set up any partitions
17 diskparts
18
19 # start up local swapping
20 disk=`{ls /dev/sd*/swap >[2]/dev/null}
21 if (! ~ $#disk 0)
22         swap $disk(1) >/dev/null >[2=1]
23 rm -f /env/disk
24
25 # we do this before we have a name.  we may need to do network
26 # setup so that we can get a name.
27 if(test -e /rc/bin/termrc.local)
28         . /rc/bin/termrc.local
29
30 # cs sets sysname (termrc.local may already have started it so check)
31 if(! test -e /srv/cs && ! test -e /net/cs)
32         ndb/cs -f $NDBFILE
33 sysname=`{cat /dev/sysname}
34 if(~ $#sysname 0 || ~ $sysname ''){
35         sysname=cirno                   # default
36         echo -n $sysname >/dev/sysname
37 }
38
39 # machine specific startup (e.g., for devices not probed)
40 if(test -e /cfg/$sysname/termrc)
41         . /cfg/$sysname/termrc
42
43 # start IP on the LAN, if not already configured.  diskless terminals
44 # are already configured by now.  It's commented out to avoid a long timeout
45 # on startup waiting for DHCP.
46 #
47 # If your site provides DHCP service,
48 #
49 #if(! test -e /net/ipifc/0/ctl)
50 #       ip/ipconfig
51 #
52 # Otherwise, see /cfg/$sysname/termrc (/cfg/example/termrc is an example).
53
54 # start dns if we have an internet
55 if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)
56         ndb/dns -r
57
58 if(! ~ $terminal *vx32*){
59         # start timesync if it isn't running and we weren't told not to
60         if(! ps|grep -s timesync)
61                 if(! ~ $TIMESYNCARGS '')
62                         aux/timesync $TIMESYNCARGS
63
64         # add the loop-back medium
65         if(! grep -s 127.0.0.1 /net/ipselftab)
66                 ip/ipconfig loopback /dev/null 127.1 >/dev/null >[2=1]
67
68         # set things up for vmware
69         if(! ~ `{cat /dev/user} none)
70                 if(test -e /bin/aux/vmware)
71                         aux/vmware
72 }
73
74 fn ask {
75         if(~ $"$1 ask){
76                 echo -n $1
77                 echo -n $2
78                 echo -n ' ['
79                 echo -n $3
80                 echo -n '] '
81                 $1=`{read}
82                 if(~ $"$1 '!rc'){
83                         rc -i
84                         $1=ask
85                 }
86                 if(~ $#$1 0)
87                         $1=$3
88                 ask $*
89         }
90 }
91
92 ask vgasize ' is (text, 640x480x8, 1024x768x16, ...)' 1024x768x16
93 if(! ~ $"vgasize '' text none){
94         ask monitor ' is (vesa, xga, lcd, ...)' vesa
95         if(! ~ $"monitor ''){
96                 if(test -f /dev/mousectl)
97                         ask mouseport ' is (ps2, ps2intellimouse, 0, 1, 2)' ps2
98                 if not
99                         mouseport=none
100                 @{
101                         rfork n
102                         if(~ $monitor vesa)
103                                 aux/realemu
104                         aux/vga -l $vgasize
105                 }
106                 switch($mouseport){
107                 case ps2 ps2intellimouse 0 1 2
108                         aux/mouse $mouseport
109                         if(~ $accupoint 1)
110                                 pipefile -dr /bin/aux/accupoint /dev/mouse
111                 }
112         }
113 }
114 rm -f '/env/fn#ask'
115
116 if (test -f /dev/apm)
117         aux/apm
118
119 dontkill '^(ipconfig|factotum|mntgen|fossil|kfs|cwfs.*|cs|dns|listen|reboot)$'