spacepaste

  1.  
  2. #!/bin/bash
  3. #
  4. # /etc/rc: system boot script
  5. #
  6. echo "The system is coming up. Please wait."
  7. # Load configuration
  8. . /etc/rc.conf
  9. # Start udev
  10. /bin/mount -t proc none /proc
  11. /bin/mount -t sysfs none /sys
  12. /sbin/start_udev
  13. # Create device-mapper device nodes and scan for LVM volume groups
  14. if [ -x /sbin/lvm ]; then
  15. /sbin/vgscan --mknodes --ignorelockingfailure
  16. /sbin/vgchange --sysinit -a y
  17. fi
  18. # Mount root read-only
  19. /bin/mount -o remount,ro /
  20. if [ -f /forcefsck ]; then
  21. FORCEFSCK="-f"
  22. fi
  23. # Check filesystems
  24. /sbin/fsck $FORCEFSCK -A -T -C -a
  25. if [ $? -gt 1 ]; then
  26. echo
  27. echo "*************** FILESYSTEM CHECK FAILED ******************"
  28. echo "* *"
  29. echo "* Please repair manually and reboot. Note that the root *"
  30. echo "* file system is currently mounted read-only. To remount *"
  31. echo "* it read-write type: mount -n -o remount,rw / *"
  32. echo "* When you exit the maintainance shell the system will *"
  33. echo "* reboot automatically. *"
  34. echo "* *"
  35. echo "************************************************************"
  36. echo
  37. /sbin/sulogin -p
  38. echo "Automatic reboot in progress..."
  39. /bin/umount -a -r
  40. /bin/mount -o remount,ro /
  41. /sbin/reboot -f
  42. exit 0
  43. fi
  44. # Mount local filesystems
  45. /bin/mount -o remount,rw /
  46. /bin/mount -a -O no_netdev
  47. # Activate swap
  48. /sbin/swapon -a
  49. # Clean up misc files
  50. : > /var/run/utmp
  51. /bin/rm -rf /forcefsck /fastboot /etc/nologin /etc/shutdownpid
  52. (cd /var/run && /usr/bin/find . -name "*.pid" -delete)
  53. (cd /var/lock && /usr/bin/find . ! -type d -delete)
  54. (cd /tmp && /usr/bin/find . ! -name . -delete)
  55. /bin/mkdir -m 1777 /tmp/.ICE-unix
  56. # Set kernel variables
  57. /sbin/sysctl -p > /dev/null
  58. # Update shared library links
  59. /sbin/ldconfig
  60. # Configure host name
  61. if [ "$HOSTNAME" ]; then
  62. echo "hostname: $HOSTNAME"
  63. /bin/hostname $HOSTNAME
  64. fi
  65. # Load random seed
  66. /bin/cat /var/lib/urandom/seed > /dev/urandom
  67. # Configure system clock
  68. if [ "$TIMEZONE" ]; then
  69. /bin/ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
  70. fi
  71. /sbin/hwclock --hctosys
  72. # Load console font
  73. if [ "$FONT" ]; then
  74. echo "font: $FONT"
  75. /usr/bin/setfont $FONT
  76. fi
  77. # Load console keymap
  78. if [ "$KEYMAP" ]; then
  79. echo "keyboard: $KEYMAP"
  80. /usr/bin/loadkeys -q $KEYMAP
  81. fi
  82. # Screen blanks after 15 minutes idle time
  83. /usr/bin/setterm -blank 15
  84. # Run module initialization script
  85. if [ -x /etc/rc.modules ]; then
  86. /etc/rc.modules
  87. fi
  88. # Save boot messages
  89. /bin/dmesg > /var/log/boot
  90. # End of file
  91.