]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/termrc
merge
[plan9front.git] / rc / bin / termrc
1 #!/bin/rc
2 # terminal startup
3 TIMESYNCARGS=(-rLa1000000)
4
5 mntgen -s slashn && chmod 666 /srv/slashn
6
7 # bind all likely devices
8 for(i in S f k t m i v L P u U A '$' Σ κ)
9         bind -a '#'^$i /dev >/dev/null >[2=1]
10 rm -f /env/i
11
12 mount -qb /srv/cons /dev
13 mount -qa /srv/usb /dev
14
15 # set up any partitions
16 diskparts
17
18 # start up local swapping
19 disk=`{ls /dev/sd*/swap >[2]/dev/null}
20 if (! ~ $#disk 0)
21         swap $disk(1) >/dev/null >[2=1]
22 rm -f /env/disk
23
24 # cs sets sysname
25 ndb/cs
26 sysname=`{cat /dev/sysname}
27 if(~ $#sysname 0 || ~ $sysname ''){
28         sysname=cirno                   # default
29         echo -n $sysname >/dev/sysname
30 }
31
32 # parallelism for mk
33 NPROC = `{wc -l </dev/sysstat}
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
61 fn ask {
62         if(~ $"$1 ask){
63                 echo -n $1
64                 echo -n $2
65                 echo -n ' ['
66                 echo -n $3
67                 echo -n '] '
68                 $1=`{read}
69                 if(~ $"$1 '!rc'){
70                         rc -i
71                         $1=ask
72                 }
73                 if(~ $#$1 0)
74                         $1=$3
75                 ask $*
76         }
77 }
78
79 ask vgasize ' is (text, 640x480x8, 1024x768x16, ...)' 1024x768x16
80 if(! ~ $"vgasize '' text none){
81         ask monitor ' is (vesa, xga, lcd, ...)' vesa
82         if(! ~ $"monitor ''){
83                 if(test -f /dev/mousectl)
84                         ask mouseport ' is (ps2, ps2intellimouse, 0, 1, 2)' ps2
85                 if not
86                         mouseport=none
87                 @{
88                         rfork n
89                         if(~ $monitor vesa)
90                                 aux/realemu
91                         aux/vga -l $vgasize
92                 }
93                 switch($mouseport){
94                 case ps2 ps2intellimouse 0 1 2
95                         aux/mouse $mouseport
96                         if(~ $accupoint 1)
97                                 pipefile -dr /bin/aux/accupoint /dev/mouse
98                 }
99         }
100 }
101 rm -f '/env/fn#ask'
102
103 if (test -f /dev/apm)
104         aux/apm
105
106 dontkill '^(ipconfig|factotum|mntgen|kfs|cwfs.*|cs|dns|listen|reboot)$'