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