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.

53 lines
1.1 KiB

  1. #!/bin/sh
  2. #
  3. # ROCK Linux: /etc/rc.d/rc
  4. #
  5. # This script does the switching between runlevels.
  6. #
  7. {
  8. export PATH=/bin:/sbin:/usr/bin:/usr/sbin
  9. echo "** running rc script **"
  10. echo "RC: Previous runlevel: $PREVLEVEL, new runlevel: $RUNLEVEL."
  11. curdir=/etc/rc.d/rc$RUNLEVEL.d
  12. prevdir=/etc/rc.d/rc$PREVLEVEL.d
  13. #
  14. # run the KILL scripts of the previous runlevel (if needed)
  15. #
  16. if ! [ $PREVLEVEL = S -o $PREVLEVEL = N ]
  17. then
  18. echo "RC: Leave runlevel $PREVLEVEL ..."
  19. for i in $prevdir/K*; do
  20. test -x "$i" || continue
  21. x="`echo "$i" | sed "s,$prevdir/K..,$curdir/S??,"`"
  22. [ "`echo $x`" = "$x" ] || continue
  23. /sbin/rc --nobtee $i stop
  24. done
  25. fi
  26. echo "RC: Enter runlevel $RUNLEVEL ..."
  27. if [ $RUNLEVEL != 0 -a $RUNLEVEL != 6 -a $RUNLEVEL != S ]
  28. then
  29. #
  30. # run the START scripts of the current (new) runlevel
  31. #
  32. for i in $curdir/S*; do
  33. test -x "$i" || continue
  34. x="`echo "$i" | sed "s,$curdir/S..,$prevdir/K??,"`"
  35. [ "`echo $x`" = "$x" ] || continue
  36. /sbin/rc --nobtee $i start
  37. done
  38. fi
  39. echo "RC: The system is now in runlevel $RUNLEVEL."
  40. # write EOT mark for btee
  41. echo -ne '\004'
  42. } 2>&1 | /sbin/btee a /var/log/init.msg
  43. exit 0