#!/bin/sh # # --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/base/sysfiles/system.init # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at http://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- # # Desc: System bootup and shutdown # Runlevel: 01 rcX rc1 rc2 rc3 rc4 rc5 # main_begin block_begin(start, `Mounting /proc and /sys.') if [ ! -e /proc/self ]; then check(`mount -n -t proc proc /proc') fi if [ ! -e /sys/kernel ]; then check(`mount -n -t sysfs sysfs /sys') fi dnl block_split(`Setting kernel clock to local time.') [ -f /etc/conf/clock ] && . /etc/conf/clock if [ "$clock_tz" = localtime ] ; then check(`hwclock --hctosys --localtime') fi dnl block_split(`Setting enhanced real time clock precision to $clock_rtc.') if [ "$clock_rtc" ] ; then if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then check(`echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq') else echo "No /proc/sys/dev/rtc/max-user-freq found." fi fi dnl block_split(`Setting hostname to $(cat /etc/HOSTNAME).') check(`hostname "$(cat /etc/HOSTNAME)"') dnl block_split(`Setting up loopback networking.') check(`ip link set lo up') ip addr add 127.0.0.1/8 dev lo ip route add 127/8 dev lo dnl block_split(`Setting overflow UID and GID kernel parameters.') check(`sysctl -w kernel.overflowuid=$(grep ^nobody: /etc/passwd | cut -f 3 -d:) > /dev/null') check(`sysctl -w kernel.overflowgid=$(grep ^nobody: /etc/passwd | cut -f 4 -d:) > /dev/null') dnl block_split(`Reading /etc/sysctl.conf file.') check(`sysctl -p') block_end block_begin(stop, `Sending all processes a 2nd TERM signal.') check(`killall5 -15') ; sleep 5 block_split(`Sending all processes a KILL signal.') check(`killall5 -9') ; sleep 5 dnl block_split(`Unmounting remaining file systems.') grep -E -v '^none (/|[a-z]+:) ' /proc/mounts > /etc/mtab sync ; sleep 1 ; sync umount -vdnra -t nodevfs,proc,sysfs,shm mount -vn -o remount,sync / mount -vn -o remount,ro / sleep 1 ; sync ; sleep 1 dnl block_split() command="" [ "$RUNLEVEL" = 0 ] && command=halt [ "$RUNLEVEL" = 6 ] && command=reboot if [ -n "$command" ] ; then echo "Going to $command the system ..." $command -d -f -i -p while true ; do sleep 1 ; done fi block_end main_end