]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/system/rc
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 # This sets a few default terminal options.
28 # These 3 signals will not cause our script to exit
31 [ "${1}" != "" ] && runlevel
=${1}
33 if [ "${runlevel}" = "" ]; then
34 echo "Usage: ${0} <runlevel>" >&2
39 [ "${previous}" = "" ] && previous
=N
41 if [ ! -d ${rc_base}/rc
${runlevel}.d
]; then
42 boot_mesg
"${rc_base}/rc${runlevel}.d does not exist." ${WARNING}
47 # Attempt to stop all service started by previous runlevel,
48 # and killed in this runlevel
49 if [ "${previous}" != "N
" ]; then
50 for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null)
54 suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]}
55 prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
56 sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix
58 if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
59 if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
60 boot_mesg -n "WARNING
:\n\n${i} can
't be" ${WARNING}
61 boot_mesg -n " executed because it was not"
62 boot_mesg -n " not started in the previous"
63 boot_mesg -n " runlevel (${previous})."
64 boot_mesg "" ${NORMAL}
72 if [ "${error_value}" != "0" ]; then
78 #Start all functions in this runlevel
79 for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null)
81 suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]}
83 # Skip if initscript is disabled at bootprompt
84 grep "skipinit=$suffix" /proc/cmdline >/dev/null 2>&1 && continue
86 if [ "${previous}" != "N" ]; then
87 stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix
88 prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
90 [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue
105 if [ "${error_value}" != "0" ]; then