/etc/init.d/rcS is in file-rc 0.8.15.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | #! /bin/sh
#
# rcS - Help to boot the system into single user mode
# Copyright (c) 1998 Martin Schulze <joey@debian.org>
# 1998 Winfried Trümper <winni@xpilot.org>
# 1998 Miquel van Smoorenburg <miquels@cistron.nl>
# 1999-2000 Roland Rosenfeld <roland@spinnaker.de>
# 2010 Alexander Wirt <formorer@formorer.de>
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Ideas taken from rcS as provided by the sysvinit package and from
# the file-rc /etc/init.d/rc program
PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
CFGFILE="/etc/runlevel.conf"
BAKCFG="/etc/runlevel.fallback"
#
# See if system needs to be setup. This is ONLY meant to
# be used for the initial setup after a fresh installation!
#
if [ -x /sbin/unconfigured.sh ]
then
/sbin/unconfigured.sh
fi
#
# Source defaults.
#
. /etc/default/rcS
export VERBOSE
#
# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
trap ":" INT QUIT TSTP
element() {
element="$1"
[ "$2" = "in" ] && shift
list="$2"
[ "$list" = "-" ] && return 1
[ "$list" = "*" ] && return 0
ORGIFS="$IFS"
IFS=","
set -- $list
IFS="$ORGIFS"
case $element in
"$1" | "$2" | "$3" | "$4" | "$5" | "$6" | "$7" | "$8" | "$9")
return 0
esac
return 1
}
CMDLIST="set centerline=here"
#
# If $CFGFILE isn't available, try the fallback:
#
if [ ! -f "$CFGFILE" ]
then
echo "Missing configuration file '$CFGFILE' using fallback config."
if [ -f "$BAKCFG" ]
then
CFGFILE="$BAKCFG"
else
echo "No configuration file at all. You're in serious trouble now."
CFGFILE="/dev/null"
fi
fi
# read the file...
while read SORT_NO OFF_LEVELS ON_LEVELS CMD OPTIONS
do
case "$SORT_NO" in
\#* | "") continue ;;
esac
[ ! -f "$CMD" ] && continue
# continue only if CMD was not started in previous runlevel
if element "$runlevel" in "$ON_LEVELS"
then
STARTS="$STARTS $SORT_NO:$CMD"
fi
done < $CFGFILE
for x in 0 1 2 3 4 5 6 7 8 9
do
for y in 0 1 2 3 4 5 6 7 8 9
do
for entry in $STARTS
do
SORT_NUM=${entry%%:*}
CMD=${entry#*:}
if [ $SORT_NUM -eq $x$y ]
then
# append CMD to the list of
case "$CMD" in
*.sh) CMDLIST="$CMDLIST; (set -- start; . $CMD)" ;;
*) [ -x "$CMD" ] && CMDLIST="$CMDLIST; $CMD start" ;;
esac
fi
done
done
done
# Execute the commands collected above
(trap - INT QUIT TSTP; sh -c "$CMDLIST")
#
# For compatibility, run the files in /etc/rc.boot too.
#
[ -d /etc/rc.boot ] && run-parts /etc/rc.boot
#
# Finish setup if needed. The comment above about
# /sbin/unconfigured.sh applies here as well!
#
if [ -x /sbin/setup.sh ]
then
/sbin/setup.sh
fi
|