5 kx #!/bin/sh
5 kx #
5 kx # rc.sysvinit This file provides basic compatibility with SystemV style
5 kx # startup scripts. The SystemV style init system places start/stop
5 kx # scripts for each runlevel into directories such as /etc/rc.d/rc3.d
5 kx # (for runlevel 3) instead of starting them from /etc/rc.d/rc.M.
5 kx # This makes for a lot more init scripts, and a more complicated
5 kx # execution path to follow through if something goes wrong. For
5 kx # this reason, Radix has always used the traditional BSD style
5 kx # init script layout.
5 kx #
5 kx # However, many binary packages exist that install SystemV init scripts.
5 kx # With rc.sysvinit in place, most well-written startup scripts will work.
5 kx # This is primarily intended to support commercial software, though,
5 kx # and probably shouldn't be considered bug free.
5 kx #
5 kx # Written by Patrick Volkerding <volkerdi@slackware.com>, 1999
5 kx # from an example by Miquel van Smoorenburg <miquels@cistron.nl>.
5 kx
5 kx # Run an init script:
5 kx startup() {
5 kx case "$1" in
5 kx *.sh)
5 kx sh "$@"
5 kx ;;
5 kx *)
5 kx "$@"
5 kx ;;
5 kx esac
5 kx }
5 kx
5 kx # Set onlcr to avoid staircase effect.
5 kx stty onlcr 0>&1
5 kx
5 kx if [ "$runlevel" = "" ]; then
5 kx runlevel=$RUNLEVEL
5 kx export runlevel
5 kx prevlevel=$PREVLEVEL
5 kx export prevlevel
5 kx fi
5 kx
5 kx # Run kill scripts in the previous runlevel if not "none"
5 kx if [ ! "$prevlevel" = "N" ]; then
5 kx for script in /etc/rc.d/rc$prevlevel.d/K* ; do
5 kx if [ -x $script ]; then
5 kx startup $script stop
5 kx fi
5 kx done
5 kx fi
5 kx
5 kx # Now do the startup scripts:
5 kx for script in /etc/rc.d/rc$runlevel.d/S* ; do
5 kx if [ -x $script ]; then
5 kx startup $script start
5 kx fi
5 kx done