termrc 2.5 KB

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