termrc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. if(test -e /rc/bin/termrc.local)
  17. . /rc/bin/termrc.local
  18. # cs sets sysname (termrc.local may already have started it so check)
  19. if(! test -e /srv/cs)
  20. ndb/cs -f $NDBFILE
  21. sysname=`{cat /dev/sysname}
  22. # machine specific startup (e.g., for devices not probed)
  23. if(test -e /cfg/$sysname/termrc)
  24. . /cfg/$sysname/termrc
  25. # start IP on the LAN, if not already configured. diskless terminals
  26. # are already configured by now. It's commented out to avoid a long timeout
  27. # on startup waiting for DHCP.
  28. #
  29. # If your site provides DHCP service,
  30. #
  31. #if(! test -e /net/ipifc/0/ctl)
  32. # ip/ipconfig
  33. #
  34. # Otherwise, see /cfg/$sysname/termrc (/cfg/example/termrc is an example).
  35. # start dns if we have an internet
  36. if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)
  37. ndb/dns -r
  38. # start timesync if it isn't running and we weren't told not to
  39. if(! ps|grep -s timesync)
  40. if(! ~ $TIMESYNCARGS '')
  41. aux/timesync $TIMESYNCARGS
  42. # add the loop-back device
  43. if(grep -s loopback /dev/drivers)
  44. ip/ipconfig loopback /dev/null 127.1
  45. # set things up for vmware
  46. if(! ~ `{cat /dev/user} none)
  47. if(test -e /bin/aux/vmware)
  48. aux/vmware
  49. # query user if terminal isn't adequately configured yet
  50. if(~ $mouseport ask){
  51. echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
  52. mouseport=`{read}
  53. if(~ $#mouseport 0)
  54. mouseport=ps2
  55. }
  56. if(~ $vgasize ask){
  57. echo -n 'vgasize [640x480x8]: '
  58. vgasize=`{read}
  59. if(~ $#vgasize 0)
  60. vgasize=640x480x8
  61. }
  62. if(~ $monitor ask){
  63. echo -n 'monitor is [xga]: '
  64. monitor=`{read}
  65. if(~ $#monitor 0)
  66. monitor=xga
  67. }
  68. if(test -f /dev/mousectl){
  69. switch($mouseport){
  70. case ps2 ps2intellimouse 0 1 2
  71. aux/mouse $mouseport
  72. # parse vgasize into fields
  73. vgasize=`{echo $vgasize}
  74. if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
  75. aux/vga -l $vgasize
  76. if(~ $accupoint 1)
  77. pipefile -dr /bin/aux/accupoint /dev/mouse
  78. }
  79. }
  80. usbstart
  81. if (test -f /dev/apm)
  82. aux/apm