3 # hdw - linux /etc/init.d/rc (modified for fai)
5 # controls switching of runlevels (copied from ROCK Linux)
10 export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/fai/scripts
12 echo "** running rc (fai) script **"
14 echo "RC: Previous runlevel: $PREVLEVEL, current runlevel: $RUNLEVEL."
16 curdir=/etc/init.d/rc$RUNLEVEL.d
17 prevdir=/etc/init.d/rc$PREVLEVEL.d
20 # run the KILL scripts of the previous runlevel (if needed)
22 if ! [ $PREVLEVEL = S -o $PREVLEVEL = N ]
24 echo "RC: Leave runlevel $PREVLEVEL ..."
25 for i in $prevdir/K*; do
26 test -x "$i" || continue
27 x="`echo "$i" | sed "s,$prevdir/K..,$curdir/S??,"`"
28 [ "`echo $x`" = "$x" ] || continue ; unset x
33 echo "RC: Enter runlevel $RUNLEVEL ..."
40 echo "Sending all processes a SIGTERM (15) ..."
43 echo "Sending all processes a 2nd SIGTERM (15) ..."
46 echo "Sending all processes a SIGKILL (9) ..."
49 elif [ $RUNLEVEL = 0 -o $RUNLEVEL = 6 ]
52 # shut down the system
54 if [ $RUNLEVEL = 0 ] ; then
55 mode=halt ; else mode=reboot ; fi
56 /etc/init.d/down $mode
60 # run the START scripts of the current (new) runlevel
62 for i in $curdir/S*; do
63 test -x "$i" || continue
64 x="`echo "$i" | sed "s,$curdir/S..,$prevdir/K??,"`"
65 [ "`echo $x`" = "$x" ] || continue ; unset x
70 echo "mounting fai config space ..."
74 echo "executing rc_fai.sh script ..."
75 /fai/scripts/rc_fai.sh
78 if [ -f /tmp/fai_finished ] ; then
80 echo "FAI finished - congrats :)"
82 echo "you may login as root (passwd = hdw), chroot to /trg and"
83 echo "do further modifications."
86 echo "login: root | passwd = hdw"