xref: /plan9/rc/bin/termrc (revision 850dd0ca1bdf035e1410f3ad77ab360045f4571d)
1#!/bin/rc
2# terminal startup
3TIMESYNCARGS=(-rLa1000000)
4NDBFILE=/lib/ndb/local
5
6mntgen -s slashn && chmod 666 /srv/slashn
7
8# bind all likely devices (#S was bound in boot)
9for(i in f t m v L P U '$' Σ κ)
10	/bin/bind -a '#'^$i /dev >/dev/null >[2=1]
11
12# set up any partitions
13diskparts
14
15# start up local swapping
16disk=`{ls /dev/sd*/swap >[2]/dev/null}
17if (! ~ $#disk 0)
18	swap $disk(1) >/dev/null >[2=1]
19rm /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.
23if(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)
27if(! test -e /srv/cs)
28	ndb/cs -f $NDBFILE
29sysname=`{cat /dev/sysname}
30if (~ $#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)
36if(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
51if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)
52	ndb/dns -r
53
54# start timesync if it isn't running and we weren't told not to
55if(! ps|grep -s timesync)
56	if(! ~ $TIMESYNCARGS '')
57		aux/timesync $TIMESYNCARGS
58
59# add the loop-back device
60if(grep -s loopback /dev/drivers)
61	ip/ipconfig loopback /dev/null 127.1
62
63# set things up for vmware
64if(! ~ `{cat /dev/user} none)
65	if(test -e /bin/aux/vmware)
66		aux/vmware
67
68# query user if terminal isn't adequately configured yet
69if(~ $mouseport ask){
70	echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
71	mouseport=`{read}
72	if(~ $#mouseport 0)
73		mouseport=ps2
74}
75if(~ $vgasize ask){
76	echo -n 'vgasize [640x480x8]: '
77	vgasize=`{read}
78	if(~ $#vgasize 0)
79		vgasize=640x480x8
80}
81if(~ $monitor ask){
82	echo -n 'monitor is [xga]: '
83	monitor=`{read}
84	if(~ $#monitor 0)
85		monitor=xga
86}
87if(test -f /dev/mousectl){
88	switch($mouseport){
89	case ps2 ps2intellimouse 0 1 2
90		aux/mouse $mouseport
91		# parse vgasize into fields
92		vgasize=`{echo $vgasize}
93		if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
94			aux/vga -l $vgasize
95		if(~ $accupoint 1)
96			pipefile -dr /bin/aux/accupoint /dev/mouse
97	}
98}
99
100usbstart
101if (test -f /dev/apm)
102	aux/apm
103