termrc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 t m v C)
  10. /bin/bind -a '#'^$i /dev >/dev/null >[2=1]
  11. # set up any partitions
  12. diskparts
  13. if(test -e /env/disk)
  14. rm /env/disk
  15. # we do this before we have a name. we may need to do network
  16. # setup so that we can get a name.
  17. if(test -e /rc/bin/termrc.local)
  18. . /rc/bin/termrc.local
  19. # cs sets sysname (termrc.local may already have started it so check)
  20. if(! test -e /srv/cs && ! test -e /net/cs)
  21. ndb/cs -f $NDBFILE
  22. sysname=`{cat /dev/sysname}
  23. if (~ $#sysname 0 || ~ $sysname '') {
  24. sysname = harvey # default
  25. echo -n $sysname >/dev/sysname
  26. }
  27. # machine specific startup (e.g., for devices not probed)
  28. if(test -e /cfg/$sysname/termrc)
  29. . /cfg/$sysname/termrc
  30. # start IP on the LAN, if not already configured. diskless terminals
  31. # are already configured by now. It's commented out to avoid a long timeout
  32. # on startup waiting for DHCP.
  33. #
  34. # If your site provides DHCP service,
  35. #
  36. #if(! test -e /net/ipifc/0/ctl)
  37. # ip/ipconfig
  38. #
  39. # Otherwise, see /cfg/$sysname/termrc (/cfg/example/termrc is an example).
  40. # start dns if we have an internet
  41. if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)
  42. ndb/dns -r
  43. if(! ~ $terminal *vx32* && ! ~ $terminal *ninep*){
  44. # start timesync if it isn't running and we weren't told not to
  45. if(! ps|grep -s timesync)
  46. if(! ~ $TIMESYNCARGS '')
  47. aux/timesync $TIMESYNCARGS
  48. # add the loop-back medium
  49. if(! grep -s 127.0.0.1 /net/ipselftab)
  50. ip/ipconfig loopback /dev/null 127.1
  51. # set things up for vmware
  52. if(! ~ `{cat /dev/user} none)
  53. if(test -e /bin/aux/vmware)
  54. aux/vmware
  55. }
  56. # query user if terminal isn't adequately configured yet
  57. if(~ $mouseport ask){
  58. echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
  59. mouseport=`{read}
  60. if(~ $#mouseport 0)
  61. mouseport=ps2
  62. }
  63. if(~ $vgasize ask){
  64. echo -n 'vgasize [640x480x8]: '
  65. vgasize=`{read}
  66. if(~ $#vgasize 0)
  67. vgasize=640x480x8
  68. }
  69. if(~ $monitor ask){
  70. echo -n 'monitor is [xga]: '
  71. monitor=`{read}
  72. if(~ $#monitor 0)
  73. monitor=xga
  74. }
  75. if(test -f /dev/mousectl){
  76. switch($mouseport){
  77. case ps2 ps2intellimouse 0 1 2
  78. aux/mouse $mouseport
  79. ms& #soft mouse
  80. # parse vgasize into fields
  81. vgasize=`{echo $vgasize}
  82. if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
  83. aux/realemu
  84. aux/vga -m $monitor -l $vgasize
  85. if(~ $accupoint 1)
  86. pipefile -dr /bin/aux/accupoint /dev/mouse
  87. }
  88. }
  89. usbstart
  90. if (test -f /dev/apm)
  91. aux/apm
  92. dontkill '^(ipconfig|factotum|mntgen|fossil|cs|dns|listen|reboot)$'