mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.7 KiB

  1. #!/bin/sh
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/package/base/sysfiles/system.init
  11. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. #
  25. # Desc: System bootup and shutdown
  26. # Runlevel: 01 rcX rc1 rc2 rc3 rc4 rc5
  27. #
  28. main_begin
  29. block_begin(start, `Mounting /proc and /sys.')
  30. if [ ! -e /proc/self ]; then
  31. check(`mount -n -t proc proc /proc')
  32. fi
  33. if [ ! -e /sys/kernel ]; then
  34. check(`mount -n -t sysfs sysfs /sys')
  35. fi
  36. dnl
  37. block_split(`Setting kernel clock to local time.')
  38. [ -f /etc/conf/clock ] && . /etc/conf/clock
  39. if [ "$clock_tz" = localtime ] ; then
  40. check(`hwclock --hctosys --localtime')
  41. fi
  42. dnl
  43. block_split(`Setting enhanced real time clock precision to $clock_rtc.')
  44. if [ "$clock_rtc" ] ; then
  45. if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then
  46. check(`echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq')
  47. else
  48. echo "No /proc/sys/dev/rtc/max-user-freq found."
  49. fi
  50. fi
  51. dnl
  52. block_split(`Setting hostname to $(cat /etc/HOSTNAME).')
  53. check(`hostname "$(cat /etc/HOSTNAME)"')
  54. dnl
  55. block_split(`Setting up loopback networking.')
  56. check(`ip link set lo up')
  57. ip addr add 127.0.0.1/8 dev lo
  58. ip route add 127/8 dev lo
  59. dnl
  60. block_split(`Setting overflow UID and GID kernel parameters.')
  61. check(`sysctl -w kernel.overflowuid=$(grep ^nobody: /etc/passwd | cut -f 3 -d:) > /dev/null')
  62. check(`sysctl -w kernel.overflowgid=$(grep ^nobody: /etc/passwd | cut -f 4 -d:) > /dev/null')
  63. dnl
  64. block_split(`Reading /etc/sysctl.conf file.')
  65. check(`sysctl -p')
  66. block_end
  67. block_begin(stop, `Sending all processes a 2nd TERM signal.')
  68. check(`killall5 -15') ; sleep 5
  69. block_split(`Sending all processes a KILL signal.')
  70. check(`killall5 -9') ; sleep 5
  71. dnl
  72. block_split()
  73. command=""
  74. [ "$RUNLEVEL" = 0 ] && command=halt
  75. [ "$RUNLEVEL" = 6 ] && command=reboot
  76. if [ -n "$command" ] ; then
  77. echo "Going to $command the system ..."
  78. $command -d -f -i -p
  79. while true ; do sleep 1 ; done
  80. fi
  81. block_end
  82. main_end