termrc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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)
  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. # 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 device
  49. if(grep -s loopback /dev/drivers)
  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. # query user if terminal isn't adequately configured yet
  56. if(~ $mouseport ask){
  57. echo -n 'mouseport is (ps2, ps2intellimouse, 0, 1, 2)[ps2]: '
  58. mouseport=`{read}
  59. if(~ $#mouseport 0)
  60. mouseport=ps2
  61. }
  62. if(~ $vgasize ask){
  63. echo -n 'vgasize [640x480x8]: '
  64. vgasize=`{read}
  65. if(~ $#vgasize 0)
  66. vgasize=640x480x8
  67. }
  68. if(~ $monitor ask){
  69. echo -n 'monitor is [xga]: '
  70. monitor=`{read}
  71. if(~ $#monitor 0)
  72. monitor=xga
  73. }
  74. if(test -f /dev/mousectl){
  75. switch($mouseport){
  76. case ps2 ps2intellimouse 0 1 2
  77. aux/mouse $mouseport
  78. # parse vgasize into fields
  79. vgasize=`{echo $vgasize}
  80. if(! ~ $"monitor '' && ! ~ `{cat /dev/user} none)
  81. aux/vga -l $vgasize
  82. if(~ $accupoint 1)
  83. pipefile -dr /bin/aux/accupoint /dev/mouse
  84. }
  85. }
  86. usbstart
  87. if (test -f /dev/apm)
  88. aux/apm
  89. dontkill '^(ipconfig|factotum|mntgen|fossil|cs|dns|listen|reboot)$'