termrc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/rc
  2. # terminal startup
  3. TIMESYNCARGS=(-rLa1000000)
  4. NDBFILE=/lib/ndb/local
  5. # Hack
  6. terminal = "ninep"
  7. mntgen -s slashn && chmod 666 /srv/slashn
  8. # bind all likely devices (#S was bound in boot)
  9. for(i in f t m v L P u U '$' Σ κ C)
  10. /bin/bind -a '#'^$i /dev >/dev/null >[2=1]
  11. # ONLY FOR LOCAL DISK! We need better hack checking
  12. # some variable to distinguish if file server is remote
  13. # or local disk.
  14. if (! ~ $terminal *ninep*) {
  15. # set up any partitions
  16. diskparts
  17. # start up local swapping
  18. disk=`{ls /dev/sd*/swap >[2]/dev/null}
  19. if (! ~ $#disk 0)
  20. swap $disk(1) >/dev/null >[2=1]
  21. rm /env/disk
  22. }
  23. # END OF ONLY LOCAL
  24. # we do this before we have a name. we may need to do network
  25. # setup so that we can get a name.
  26. if(test -e /rc/bin/termrc.local)
  27. . /rc/bin/termrc.local
  28. # cs sets sysname (termrc.local may already have started it so check)
  29. if(! test -e /srv/cs && ! test -e /net/cs)
  30. ndb/cs -f $NDBFILE
  31. sysname=`{cat /dev/sysname}
  32. if (~ $#sysname 0 || ~ $sysname '') {
  33. sysname = harvey # default
  34. echo -n $sysname >/dev/sysname
  35. }
  36. # machine specific startup (e.g., for devices not probed)
  37. if(test -e /cfg/$sysname/termrc)
  38. . /cfg/$sysname/termrc
  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. # start dns if we have an internet
  50. if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)
  51. ndb/dns -r
  52. if(! ~ $terminal *vx32* && ! ~ $terminal *ninep*){
  53. # start timesync if it isn't running and we weren't told not to
  54. if(! ps|grep -s timesync)
  55. if(! ~ $TIMESYNCARGS '')
  56. aux/timesync $TIMESYNCARGS
  57. # add the loop-back medium
  58. if(! grep -s 127.0.0.1 /net/ipselftab)
  59. ip/ipconfig loopback /dev/null 127.1
  60. # set things up for vmware
  61. if(! ~ `{cat /dev/user} none)
  62. if(test -e /bin/aux/vmware)
  63. aux/vmware
  64. }
  65. # query user if terminal isn't adequately configured yet
  66. if(~ $mouseport ask){
  67. echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
  68. mouseport=`{read}
  69. if(~ $#mouseport 0)
  70. mouseport=ps2
  71. }
  72. if(~ $vgasize ask){
  73. echo -n 'vgasize [640x480x8]: '
  74. vgasize=`{read}
  75. if(~ $#vgasize 0)
  76. vgasize=640x480x8
  77. }
  78. if(~ $monitor ask){
  79. echo -n 'monitor is [xga]: '
  80. monitor=`{read}
  81. if(~ $#monitor 0)
  82. monitor=xga
  83. }
  84. if(test -f /dev/mousectl){
  85. switch($mouseport){
  86. case ps2 ps2intellimouse 0 1 2
  87. aux/mouse $mouseport
  88. ms& #soft mouse
  89. # parse vgasize into fields
  90. vgasize=`{echo $vgasize}
  91. if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
  92. aux/realemu
  93. aux/vga -m $monitor -l $vgasize
  94. if(~ $accupoint 1)
  95. pipefile -dr /bin/aux/accupoint /dev/mouse
  96. }
  97. }
  98. usbstart
  99. if (test -f /dev/apm)
  100. aux/apm
  101. dontkill '^(ipconfig|factotum|mntgen|fossil|cs|dns|listen|reboot)$'