[Pkg-sysvinit-commits] r173 -
sysvinit/trunk/debian/sysv-rc/etc/init.d
Thomas Hood
jdthood-guest at costa.debian.org
Mon Nov 21 08:39:35 UTC 2005
Author: jdthood-guest
Date: 2005-11-21 08:39:35 +0000 (Mon, 21 Nov 2005)
New Revision: 173
Modified:
sysvinit/trunk/debian/sysv-rc/etc/init.d/rc
Log:
Add some quotation marks; fix indentation
Modified: sysvinit/trunk/debian/sysv-rc/etc/init.d/rc
===================================================================
--- sysvinit/trunk/debian/sysv-rc/etc/init.d/rc 2005-11-21 08:23:31 UTC (rev 172)
+++ sysvinit/trunk/debian/sysv-rc/etc/init.d/rc 2005-11-21 08:39:35 UTC (rev 173)
@@ -31,70 +31,70 @@
# Start script or program.
#
startup() {
- action=$1
- shift
- scripts="$@"
- sh=sh
- # Debian Policy §9.3.1 require .sh scripts in runlevel S to be sourced.
- [ S = "$runlevel" ] && sh=.
- case "$CONCURRENCY" in
- none)
- for script in $scripts ; do
- case "$script" in
- *.sh)
- $debug $sh "$script" $action
- ;;
- *)
- $debug "$script" $action
- ;;
- esac
- done
- ;;
- startpar)
- # startpar is not working as it should yet [pere 2005-09-10]
- $debug startpar -a $action $scripts
- ;;
- shell)
- backgrounded=0
- for script in $scripts ; do
- case "$script" in
- *.sh)
- $debug $sh "$script" $action
- ;;
- *)
- $debug "$script" $action &
- backgrounded=1
- ;;
- esac
- done
- [ 1 = "$backgrounded" ] && wait
- ;;
- esac
+ action=$1
+ shift
+ scripts="$@"
+ sh=sh
+ # Debian Policy §9.3.1 requires .sh scripts in runlevel S to be sourced
+ [ S = "$runlevel" ] && sh=.
+ case "$CONCURRENCY" in
+ none)
+ for script in $scripts ; do
+ case "$script" in
+ *.sh)
+ $debug $sh "$script" $action
+ ;;
+ *)
+ $debug "$script" $action
+ ;;
+ esac
+ done
+ ;;
+ startpar)
+ # startpar is not working as it should yet [pere 2005-09-10]
+ $debug startpar -a $action $scripts
+ ;;
+ shell)
+ backgrounded=0
+ for script in $scripts ; do
+ case "$script" in
+ *.sh)
+ $debug $sh "$script" $action
+ ;;
+ *)
+ $debug "$script" $action &
+ backgrounded=1
+ ;;
+ esac
+ done
+ [ 1 = "$backgrounded" ] && wait
+ ;;
+ esac
}
- # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
- trap ":" INT QUIT TSTP
+# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
+trap ":" INT QUIT TSTP
- # Set onlcr to avoid staircase effect.
- stty onlcr 0>&1
+# Set onlcr to avoid staircase effect.
+stty onlcr 0>&1
- # Now find out what the current and what the previous runlevel are.
+# Now find out what the current and what the previous runlevel are.
- runlevel=$RUNLEVEL
- # Get first argument. Set new runlevel to this argument.
- [ "$1" != "" ] && runlevel=$1
- if [ "$runlevel" = "" ]
- then
+runlevel=$RUNLEVEL
+# Get first argument. Set new runlevel to this argument.
+[ "$1" != "" ] && runlevel=$1
+if [ "$runlevel" = "" ]
+then
echo "Usage: $0 <runlevel>" >&2
exit 1
- fi
- previous=$PREVLEVEL
- [ "$previous" = "" ] && previous=N
+fi
+previous=$PREVLEVEL
+[ "$previous" = "" ] && previous=N
- export runlevel previous
+export runlevel previous
- if [ S = "$runlevel" ]
- then
+if [ S = "$runlevel" ]
+then
#
# See if system needs to be setup. This is ONLY meant to
# be used for the initial setup after a fresh installation!
@@ -103,115 +103,115 @@
then
/sbin/unconfigured.sh
fi
- fi
+fi
- . /etc/default/rcS
- export VERBOSE
+. /etc/default/rcS
+export VERBOSE
- # Is there an rc directory for this new runlevel?
- if [ -d /etc/rc$runlevel.d ]
- then
+# Is there an rc directory for this new runlevel?
+if [ -d /etc/rc$runlevel.d ]
+then
# First, run the KILL scripts.
- if [ $previous != N ]
+ if [ "$previous" != N ]
then
- # Run all scripts with the same level in parallel
- CURLEVEL=""
- for s in /etc/rc$runlevel.d/K*
- do
- level=$(echo $s | sed 's/.*\/K\([0-9][0-9]\).*/\1/')
- if [ "$level" = "$CURLEVEL" ]
- then
- continue
- fi
- CURLEVEL=$level
- SCRIPTS=""
- for i in /etc/rc$runlevel.d/K$level*
- do
- # Check if the script is there.
- [ ! -f $i ] && continue
+ # Run all scripts with the same level in parallel
+ CURLEVEL=""
+ for s in /etc/rc$runlevel.d/K*
+ do
+ level=$(echo $s | sed 's/.*\/K\([0-9][0-9]\).*/\1/')
+ if [ "$level" = "$CURLEVEL" ]
+ then
+ continue
+ fi
+ CURLEVEL=$level
+ SCRIPTS=""
+ for i in /etc/rc$runlevel.d/K$level*
+ do
+ # Check if the script is there.
+ [ ! -f $i ] && continue
- #
- # Find stop script in previous runlevel but
- # no start script there.
- #
- suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}
- previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix
- previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
- #
- # If there is a stop script in the previous level
- # and _no_ start script there, we don't
- # have to re-stop the service.
- #
- [ -f $previous_stop ] && [ ! -f $previous_start ] && continue
+ #
+ # Find stop script in previous runlevel but
+ # no start script there.
+ #
+ suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}
+ previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix
+ previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
+ #
+ # If there is a stop script in the previous level
+ # and _no_ start script there, we don't
+ # have to re-stop the service.
+ #
+ [ -f $previous_stop ] && [ ! -f $previous_start ] && continue
- # Stop the service.
- SCRIPTS="$SCRIPTS $i"
- done
- startup stop $SCRIPTS
- done
- fi
+ # Stop the service.
+ SCRIPTS="$SCRIPTS $i"
+ done
+ startup stop $SCRIPTS
+ done
+ fi
case "$runlevel" in
- 0|6)
- ACTION=stop
- ;;
- *)
- ACTION=start
- ;;
+ 0|6)
+ ACTION=stop
+ ;;
+ *)
+ ACTION=start
+ ;;
esac
- # Now run the START scripts for this runlevel.
- # Run all scripts with the same level in parallel
- CURLEVEL=""
- for s in /etc/rc$runlevel.d/S*
- do
- level=$(echo $s | sed 's/.*\/S\([0-9][0-9]\).*/\1/')
- if [ "$level" = "$CURLEVEL" ]
- then
- continue
- fi
- CURLEVEL=$level
- SCRIPTS=""
- for i in /etc/rc$runlevel.d/S$level*
- do
- [ ! -f $i ] && continue
-
- if [ $previous != N ]
+ # Now run the START scripts for this runlevel.
+ # Run all scripts with the same level in parallel
+ CURLEVEL=""
+ for s in /etc/rc$runlevel.d/S*
+ do
+ level=$(echo $s | sed 's/.*\/S\([0-9][0-9]\).*/\1/')
+ if [ "$level" = "$CURLEVEL" ]
then
- #
- # Find start script in previous runlevel and
- # stop script in this runlevel.
- #
- suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
- stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
- previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
- #
- # If there is a start script in the previous level
- # and _no_ stop script in this level, we don't
- # have to re-start the service.
- #
- [ -f $previous_start ] && [ ! -f $stop ] && continue
+ continue
fi
- SCRIPTS="$SCRIPTS $i"
- done
- startup $ACTION $SCRIPTS
- done
- fi
+ CURLEVEL=$level
+ SCRIPTS=""
+ for i in /etc/rc$runlevel.d/S$level*
+ do
+ [ ! -f $i ] && continue
- if [ S = "$runlevel" ]
- then
+ if [ "$previous" != N ]
+ then
+ #
+ # Find start script in previous runlevel and
+ # stop script in this runlevel.
+ #
+ suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
+ stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
+ previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
+ #
+ # If there is a start script in the previous level
+ # and _no_ stop script in this level, we don't
+ # have to re-start the service.
+ #
+ [ -f $previous_start ] && [ ! -f $stop ] && continue
+ fi
+ SCRIPTS="$SCRIPTS $i"
+ done
+ startup $ACTION $SCRIPTS
+ done
+fi
+
+if [ S = "$runlevel" ]
+then
#
- # For compatibility, run the files in /etc/rc.boot too.
+ # 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!
+ # 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
- fi
-# eof /etc/init.d/rc
+fi
+
More information about the Pkg-sysvinit-commits
mailing list