[Petter Reinholdtsen]
> Recently, I have been investigating how to speed up the boot process
> in Debian, and during this work, I found a simple way to change
> /etc/init.d/rc to run all init.d scripts with the same sequence
> number in parallell.

I continued on this approach a bit, using the LTSP thin client boot as
my test case, and using insserv to reorganize the symlinks in
/etc/rcS.d/ and /etc/rc2.d/ to match the dependency order I inserted
into the init.d scripts based on testing and experience.  Patch below.

The current patch take the level of concurrency as an option, and I
tested with several values (1,2,4,8).  These are the raw numbers, in
qemu seconds (which do not match wall clock seconds :).

     rcS  rc2  total    %speedup
 1  2616  204   2820        0%
 2  4752  213   4965      -76%
 4  1670  199   1869       33%
 8   877  193   1070       62%

The speedup percent is relative to the single subprocess case.

So if we can get dependency information into all the init.d scripts,
we should be able to speed up the boot process quite a bit by just
modifying the script order and running all script with the same order
value at the same time.

This is my current patch.  In addition to adding LSB headers, I change
rc and rcS to

 - write time spend in each boot script to /tmp/bootlog
 - always use a startup() function to run subscripts
 - run at most $CONCURRENCY subprocesses in parallel.

I'm working in a sarge chroot, and boot it like this, after exporting
it over NFS.

  echo "/opt/ltsp       *(ro,no_root_squash,async,insecure)" >> /etc/exports
  createdisk /tmp/hda 16 # Make dummy disk to keep qemu happy
  qemu -m 64 -kernel /opt/ltsp/i386/boot/vmlinuz-2.4.27-2-386 \
    -initrd /opt/ltsp/i386/boot/initrd.img-2.4.27-2-386 -user-net \
    -hda /tmp/hda -append "ip=dhcp root=/dev/nfs nfsroot=/opt/ltsp/i386/"

diff -u /etc/init.d/bootlogd init.d/bootlogd
--- /etc/init.d/bootlogd        2005-01-04 23:43:18.000000000 +0100
+++ init.d/bootlogd     2005-08-22 14:27:23.000000000 +0200
@@ -1,4 +1,13 @@
 #! /bin/sh
+### BEGIN INIT INFO
+# Provides:          bootlogd
+# Required-Start:    mountvirtfs
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 #
 # bootlogd     One of the first scripts to be executed. Starts or stops
 #              the bootlogd log program. If this script is called as
diff -u /etc/init.d/bootmisc.sh init.d/bootmisc.sh
--- /etc/init.d/bootmisc.sh     2004-09-10 17:00:48.000000000 +0200
+++ init.d/bootmisc.sh  2005-08-23 00:43:50.000000000 +0200
@@ -3,6 +3,16 @@
 #
 # Version:     @(#)bootmisc.sh  2.85-17  04-Jun-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          bootmisc
+# Required-Start:    $time
+# Required-Stop:     $time
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
 
 DELAYLOGIN=yes
 VERBOSE=yes
diff -u /etc/init.d/checkfs.sh init.d/checkfs.sh
--- /etc/init.d/checkfs.sh      2004-09-10 17:00:48.000000000 +0200
+++ init.d/checkfs.sh   2005-08-22 14:31:27.000000000 +0200
@@ -3,6 +3,16 @@
 #
 # Version:     @(#)checkfs  2.85-13  22-Mar-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          checkfs
+# Required-Start:    modutils
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
 
 FSCKFIX=no
 [ -f /etc/default/rcS ] && . /etc/default/rcS
diff -u /etc/init.d/checkroot.sh init.d/checkroot.sh
--- /etc/init.d/checkroot.sh    2004-09-10 17:00:48.000000000 +0200
+++ init.d/checkroot.sh 2005-08-22 14:31:55.000000000 +0200
@@ -3,6 +3,15 @@
 #
 # Version:     @(#)checkroot.sh  2.85-23  29-Jul-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          checkroot
+# Required-Start:    keymap
+# Required-Stop:     
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 SULOGIN=no
 VERBOSE=yes
diff -u /etc/init.d/console-screen.sh init.d/console-screen.sh
--- /etc/init.d/console-screen.sh       2005-02-05 10:17:28.000000000 +0100
+++ init.d/console-screen.sh    2005-08-22 14:33:01.000000000 +0200
@@ -1,4 +1,13 @@
 #!/bin/sh
+### BEGIN INIT INFO
+# Provides:          console-screen
+# Required-Start:    mountnfs
+# Required-Stop:     mountnfs
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description:       
+### END INIT INFO
 
 #
 # This is the boot script for the `console-tools' package.
diff -u /etc/init.d/devfsd init.d/devfsd
--- /etc/init.d/devfsd  2004-09-01 15:01:53.000000000 +0200
+++ init.d/devfsd       2005-08-22 14:25:27.000000000 +0200
@@ -4,6 +4,15 @@
 #                      permissions are set correctly and device symlinks
 #                      are available.
 #
+### BEGIN INIT INFO
+# Provides:          devfsd
+# Required-Start:    
+# Required-Stop:     
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description:       
+### END INIT INFO
 
 [ -x /sbin/devfsd ] || exit 0
 
diff -u /etc/init.d/discover init.d/discover
--- /etc/init.d/discover        2005-01-09 01:16:37.000000000 +0100
+++ init.d/discover     2005-08-22 14:36:08.000000000 +0200
@@ -1,4 +1,13 @@
 #!/bin/sh
+### BEGIN INIT INFO
+# Provides:          discover
+# Required-Start:    $local_fs mountvirtfs mountall
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 set -e
 
diff -u /etc/init.d/halt init.d/halt
--- /etc/init.d/halt    2004-09-10 17:00:48.000000000 +0200
+++ init.d/halt 2005-08-22 13:27:39.000000000 +0200
@@ -4,6 +4,16 @@
 #
 # Version:      @(#)halt  2.85-22  19-Jun-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          halt
+# Required-Start:    
+# Required-Stop:     
+# Default-Start:      0
+# Default-Stop:       
+# Short-Description: 
+# Description: 
+### END INIT INFO
+
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
diff -u /etc/init.d/hostname.sh init.d/hostname.sh
--- /etc/init.d/hostname.sh     2004-09-10 17:00:48.000000000 +0200
+++ init.d/hostname.sh  2005-08-22 14:30:19.000000000 +0200
@@ -3,6 +3,15 @@
 #
 # Version:     @(#)hostname.sh  1.10  26-Feb-2001  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          hostname
+# Required-Start:    ifupdown
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 if [ -f /etc/hostname ]
 then
diff -u /etc/init.d/hotplug init.d/hotplug
--- /etc/init.d/hotplug 2005-03-20 02:51:45.000000000 +0100
+++ init.d/hotplug      2005-08-22 14:15:18.000000000 +0200
@@ -4,6 +4,15 @@
 #              On startup, may simulate hotplug events for devices
 #              that were present at boot time, before filesystems
 #              used by /sbin/hotplug became available.
+### BEGIN INIT INFO
+# Provides:          hotplug
+# Required-Start:    $local_fs mountvirtfs
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
diff -u /etc/init.d/hotplug-net init.d/hotplug-net
--- /etc/init.d/hotplug-net     2005-03-20 15:09:29.000000000 +0100
+++ init.d/hotplug-net  2005-08-22 13:27:39.000000000 +0200
@@ -2,6 +2,15 @@
 #
 # nethotplug   manage Debian-specific network interfaces state files
 #
+### BEGIN INIT INFO
+# Provides:          hotplug-net
+# Required-Start:    $network hotplug
+# Required-Stop:     $network hotplug
+# Default-Start:      S 1 2 3 4 5
+# Default-Stop:       0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 case "$1" in
     start)
diff -u /etc/init.d/hwclock.sh init.d/hwclock.sh
--- /etc/init.d/hwclock.sh      2005-03-22 15:21:52.000000000 +0100
+++ init.d/hwclock.sh   2005-08-23 09:36:43.000000000 +0200
@@ -1,4 +1,14 @@
 #!/bin/sh
+exit 0
+### BEGIN INIT INFO
+# Provides:          hwclock
+# Required-Start:    console-screen
+# Required-Stop:     console-screen
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description:       
+### END INIT INFO
 # hwclock.sh   Set and adjust the CMOS clock, according to the UTC
 #              setting in /etc/default/rcS (see also rcS(5)).
 #
diff -u /etc/init.d/hwclockfirst.sh init.d/hwclockfirst.sh
--- /etc/init.d/hwclockfirst.sh 2005-03-22 15:21:52.000000000 +0100
+++ init.d/hwclockfirst.sh      2005-08-22 14:29:16.000000000 +0200
@@ -1,4 +1,13 @@
 #!/bin/bash
+### BEGIN INIT INFO
+# Provides:          hwclockfirst boot.clock
+# Required-Start:    checkroot
+# Required-Stop:     
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description:       
+### END INIT INFO
 # hwclockfirst.sh Set system clock to hardware clock, according to the UTC
 #               setting in /etc/default/rcS (see also rcS(5)).
 #
diff -u /etc/init.d/ifupdown init.d/ifupdown
--- /etc/init.d/ifupdown        2005-05-02 15:57:05.000000000 +0200
+++ init.d/ifupdown     2005-08-22 13:27:39.000000000 +0200
@@ -1,4 +1,13 @@
 #!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:          ifupdown
+# Required-Start:    $network
+# Required-Stop:     $network
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 [ -x /sbin/ifup ] || exit 0
 [ -x /sbin/ifdown ] || exit 0
diff -u /etc/init.d/ifupdown-clean init.d/ifupdown-clean
--- /etc/init.d/ifupdown-clean  2005-04-04 15:33:54.000000000 +0200
+++ init.d/ifupdown-clean       2005-08-22 14:29:39.000000000 +0200
@@ -2,6 +2,15 @@
 #
 # ifupdown-clean
 #
+### BEGIN INIT INFO
+# Provides:          ifupdown-clean
+# Required-Start:    checkroot
+# Required-Stop:     
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description:       
+### END INIT INFO
 
 set -e
 
diff -u /etc/init.d/initrd-tools.sh init.d/initrd-tools.sh
--- /etc/init.d/initrd-tools.sh 2005-04-11 00:35:48.000000000 +0200
+++ init.d/initrd-tools.sh      2005-08-22 14:27:55.000000000 +0200
@@ -4,6 +4,15 @@
 #
 # Version:             $Id: initrd-tools.sh,v 1.5 2002/08/18 00:10:30 herbert 
Exp $
 #
+### BEGIN INIT INFO
+# Provides:          initrd-tools
+# Required-Start:    bootlogd
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 . /etc/default/initrd-tools.sh
 
diff -u /etc/init.d/keymap.sh init.d/keymap.sh
--- /etc/init.d/keymap.sh       2005-02-04 20:30:55.000000000 +0100
+++ init.d/keymap.sh    2005-08-22 14:31:52.000000000 +0200
@@ -1,4 +1,13 @@
 #!/bin/sh
+### BEGIN INIT INFO
+# Provides:          keymap kbd
+# Required-Start:    initrd-tools
+# Required-Stop:     
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 #
 # Load the keymaps *as soon as possible*
diff -u /etc/init.d/klogd init.d/klogd
--- /etc/init.d/klogd   2004-11-07 13:13:48.000000000 +0100
+++ init.d/klogd        2005-08-22 13:27:39.000000000 +0200
@@ -1,5 +1,14 @@
 #! /bin/sh
 # /etc/init.d/klogd: start the kernel log daemon.
+### BEGIN INIT INFO
+# Provides:          klogd
+# Required-Start:    $syslog
+# Required-Stop:     $syslog
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: start the kernel log daemon
+# Description: multiline_description
+### END INIT INFO
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
diff -u /etc/init.d/makedev init.d/makedev
--- /etc/init.d/makedev 2004-08-18 20:43:14.000000000 +0200
+++ init.d/makedev      2005-08-22 13:27:39.000000000 +0200
@@ -1,4 +1,13 @@
 #! /bin/sh
+### BEGIN INIT INFO
+# Provides:          makedev
+# Required-Start:    $local_fs
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 N=/etc/init.d/makedev
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
diff -u /etc/init.d/modutils init.d/modutils
--- /etc/init.d/modutils        2004-12-19 11:40:09.000000000 +0100
+++ init.d/modutils     2005-08-22 14:30:41.000000000 +0200
@@ -1,5 +1,14 @@
 #! /bin/sh
 # /etc/init.d/modutils: loads the appropriate modules in `boot'.
+### BEGIN INIT INFO
+# Provides:          modutils
+# Required-Start:    hwclockfirst
+# Required-Stop:     hwclockfirst
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      6
+# Short-Description: 
+# Description:       
+### END INIT INFO
 
 
 PATH="/sbin:/bin"
diff -u /etc/init.d/mountall.sh init.d/mountall.sh
--- /etc/init.d/mountall.sh     2004-09-10 17:00:48.000000000 +0200
+++ init.d/mountall.sh  2005-08-22 14:22:59.000000000 +0200
@@ -3,6 +3,16 @@
 #
 # Version:     @(#)mountall.sh  2.85-23  29-Jul-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          boot.localfs
+# Required-Start:    checkfs
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
 
 VERBOSE=yes
 TMPTIME=0
diff -u /etc/init.d/mountnfs.sh init.d/mountnfs.sh
--- /etc/init.d/mountnfs.sh     2004-09-10 17:02:14.000000000 +0200
+++ init.d/mountnfs.sh  2005-08-22 14:33:21.000000000 +0200
@@ -9,6 +9,16 @@
 #
 # Version:     @(#)mountnfs.sh  2.86-5  10-Sep-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          mountnfs nfs
+# Required-Start:    $network
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
 
 VERBOSE=yes
 TMPTIME=0
diff -u /etc/init.d/mountvirtfs init.d/mountvirtfs
--- /etc/init.d/mountvirtfs     2004-09-10 17:00:48.000000000 +0200
+++ init.d/mountvirtfs  2005-08-22 14:25:23.000000000 +0200
@@ -14,6 +14,16 @@
 # Version:     @(#)mountvirtfs  2.85-23  29-Jul-2004  miquels
 #
 
+### BEGIN INIT INFO
+# Provides:          mountvirtfs
+# Required-Start:    devfsd
+# Required-Stop: 
+# Default-Start:      S 1 2 3 4 5
+# Default-Stop:       0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
+
 # Script needs to be robust and continue when parts fail,
 # so we're not setting the "-e" flag.
 #set -e
diff -u /etc/init.d/networking init.d/networking
--- /etc/init.d/networking      2005-03-21 19:49:41.000000000 +0100
+++ init.d/networking   2005-08-22 14:16:04.000000000 +0200
@@ -1,6 +1,16 @@
 #!/bin/sh
 #
 # manage network interfaces and configure some networking options
+### BEGIN INIT INFO
+# Provides:          network
+# Required-Start:    mountvirtfs
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Defaulg-Stop:      6
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
diff -u /etc/init.d/procps.sh init.d/procps.sh
--- /etc/init.d/procps.sh       2004-04-13 07:26:28.000000000 +0200
+++ init.d/procps.sh    2005-08-22 13:27:39.000000000 +0200
@@ -3,6 +3,16 @@
 #
 # written by Elrond <[EMAIL PROTECTED]>
 
+### BEGIN INIT INFO
+# Provides:          procps
+# Required-Start:    mountvirtfs
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
+
 # Check for existance of the default file and exit if not there,
 # Closes #52839 for the boot-floppy people
 [ -r /etc/default/rcS ] || exit 0
diff -u /etc/init.d/rc init.d/rc
--- /etc/init.d/rc      2004-09-10 17:00:48.000000000 +0200
+++ init.d/rc   2005-08-23 10:15:51.000000000 +0200
@@ -18,10 +18,19 @@
 # Un-comment the following for debugging.
 # debug=echo
 
+CONCURRENCY=8
+
+. /etc/default/rcS
+
+runlog=/tmp/bootlog
+rcstart=`date +%s`
+
 #
 # Start script or program.
 #
 startup() {
+  service=$1
+  start=`date +%s`
   case "$1" in
        *.sh)
                $debug sh "$@"
@@ -30,6 +39,9 @@
                $debug "$@"
                ;;
   esac
+  stop=`date +%s`
+  spent=`expr $stop - $start`
+  echo $stop $spent $service >> $runlog
 }
 
   # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
@@ -59,17 +71,46 @@
        # First, run the KILL scripts.
        if [ $previous != N ]
        then
-               for i in /etc/rc$runlevel.d/K[0-9][0-9]*
+               # Run all scripts with the same level in parallell
+               for level in `ls /etc/rc$runlevel.d | \
+                             grep '^K[0-9][0-9]' | \
+                             cut -c2,3 | sort -u` ; do
+                       pids=""
+                       subs=0
+                       for i in /etc/rc$runlevel.d/K$level*
                do
                        # Check if the script is there.
                        [ ! -f $i ] && continue
 
                        # Stop the service.
-                       startup $i stop
+                               startup $i stop &
+                               pids="$pids $!"
+                               subs=`expr $subs + 1`
+
+               # Enough sub-processes running?
+                               if [ "$CONCURRENCY" -le "$subs" ] ; then
+                                       for pid in $pids ; do
+                                               wait $pid
+                                               subs=`expr $subs - 1`
+                                       done
+                                       pids=""
+                               fi
+                       done
+                       # Wait for all pids.  Does not matter which
+                       # pid return first, as we need to wait for all
+                       # of them
+                       for pid in $pids ; do
+                               wait $pid
+                       done
                done
        fi
        # Now run the START scripts for this runlevel.
-       for i in /etc/rc$runlevel.d/S*
+
+       # Run all scripts with the same level in parallell
+       for level in `ls /etc/rc$runlevel.d | grep '^S[0-9][0-9]' | \
+                     cut -c2,3 | sort -u` ; do
+               pids=""
+               for i in /etc/rc$runlevel.d/S$level*
        do
                [ ! -f $i ] && continue
 
@@ -91,12 +132,25 @@
                fi
                case "$runlevel" in
                        0|6)
-                               startup $i stop
+                                       startup $i stop &
                                ;;
                        *)
-                               startup $i start
+                                       startup $i start &
                                ;;
                esac
+                       pids="$pids $!"
+               done
+               # Wait for all pids.  Does not matter which
+               # pid return first, as we need to wait for all
+               # of them
+               for pid in $pids ; do
+                       wait $pid
+               done
        done
   fi
+
+rcstop=`date +%s`
+rcspent=`expr $rcstop - $rcstart`
+echo $rcstop $rcspent rc$RUNLEVEL >> $runlog
+
 # eof /etc/init.d/rc
diff -u /etc/init.d/rcS init.d/rcS
--- /etc/init.d/rcS     2004-09-10 17:00:48.000000000 +0200
+++ init.d/rcS  2005-08-23 10:15:49.000000000 +0200
@@ -12,6 +12,8 @@
 umask 022
 export PATH runlevel prevlevel
 
+set -x
+
 #
 #      See if system needs to be setup. This is ONLY meant to
 #      be used for the initial setup after a fresh installation!
@@ -21,39 +23,70 @@
   /sbin/unconfigured.sh
 fi
 
+CONCURRENCY=8
 #
 #      Source defaults.
 #
 . /etc/default/rcS
 export VERBOSE
 
+runlog=/tmp/bootlog
+rcstart=`date +%s`
 #
 #      Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
 #
 trap ":" INT QUIT TSTP
 
 #
+# Start script or program.
+#
+startup() {
+  service=$1
+  start=`date +%s`
+  case "$1" in
+       *.sh)
+               $debug sh "$@"
+               ;;
+       *)
+               $debug "$@"
+               ;;
+  esac
+  stop=`date +%s`
+  spent=`expr $stop - $start`
+  echo $stop $spent $service >> $runlog
+}
+
+#
 #      Call all parts in order.
 #
-for i in /etc/rcS.d/S??*
-do
-       # Ignore dangling symlinks for now.
-       [ ! -f "$i" ] && continue
-
-       case "$i" in
-               *.sh)
-                       # Source shell script for speed.
-                       (
-                               trap - INT QUIT TSTP
-                               set start
-                               . $i
-                       )
-                       ;;
-               *)
-                       # No sh extension, so fork subprocess.
-                       $i start
-                       ;;
-       esac
+# Run all scripts with the same level in parallell
+for level in `ls /etc/rcS.d | \
+              grep '^S[0-9][0-9]' | \
+              cut -c2,3 | sort -u` ; do
+       pids=""
+       subs=0
+       for i in /etc/rcS.d/S$level*
+       do
+               # Ignore dangling symlinks for now.
+               [ ! -f "$i" ] && continue
+               startup $i start &
+               pids="$pids $!"
+               subs=`expr $subs + 1`
+
+               # Enough sub-processes running?
+               if [ "$CONCURRENCY" -le "$subs" ] ; then
+                       for pid in $pids ; do
+                               wait $pid
+                               subs=`expr $subs - 1`
+                       done
+                       pids=""
+               fi
+       done
+       # Wait for all remaining pids.  Does not matter which pid
+       # return first, as we need to wait for all of them
+       for pid in $pids ; do
+               wait $pid
+       done
 done
 
 #
@@ -70,3 +103,7 @@
   /sbin/setup.sh
 fi
 
+rcstop=`date +%s`
+rcspent=`expr $rcstop - $rcstart`
+echo $rcstop $rcspent rcS >> $runlog
+
diff -u /etc/init.d/reboot init.d/reboot
--- /etc/init.d/reboot  2004-09-10 17:00:48.000000000 +0200
+++ init.d/reboot       2005-08-22 13:27:39.000000000 +0200
@@ -4,6 +4,17 @@
 #
 # Version:      @(#)reboot  2.75  22-Jun-1998  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          reboot
+# Required-Start:    
+# Required-Stop:     
+# Default-Start:     0 6
+# Default-Stop:      S 1 2 3 4 5
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
+
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
diff -u /etc/init.d/rmnologin init.d/rmnologin
--- /etc/init.d/rmnologin       2004-09-10 17:00:48.000000000 +0200
+++ init.d/rmnologin    2005-08-22 13:27:39.000000000 +0200
@@ -5,6 +5,15 @@
 #
 # Version:     @(#)rmnologin  2.85-13  22-Mar-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          rmnologin
+# Required-Start:    
+# Required-Stop: 
+# Default-Start:      S 1 2 3 4 5
+# Default-Stop:       
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 DELAYLOGIN=yes
 [ -f /etc/default/rcS ] && . /etc/default/rcS
diff -u /etc/init.d/sendsigs init.d/sendsigs
--- /etc/init.d/sendsigs        2004-09-10 17:00:48.000000000 +0200
+++ init.d/sendsigs     2005-08-22 13:27:39.000000000 +0200
@@ -4,6 +4,16 @@
 #
 # Version:      @(#)sendsigs  2.85-8  05-Nov-2003  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          sendsigs
+# Required-Start:    
+# Required-Stop: 
+# Default-Start:      6
+# Default-Stop:       
+# Short-Description: 
+# Description: 
+### END INIT INFO
+
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
diff -u /etc/init.d/single init.d/single
--- /etc/init.d/single  2004-09-10 17:00:48.000000000 +0200
+++ init.d/single       2005-08-22 13:27:39.000000000 +0200
@@ -4,6 +4,16 @@
 #
 # Version:     @(#)single  2.85-18  04-Jun-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          single
+# Required-Start:    $local_fs
+# Required-Stop:     $local_fs
+# Default-Start:     S
+# Default-Stop:      0 1 2 3 4 5 6
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
 
 PATH="/sbin:/bin:/usr/sbin:/usr/bin"
 
diff -u /etc/init.d/ssh init.d/ssh
--- /etc/init.d/ssh     2004-11-28 16:33:47.000000000 +0100
+++ init.d/ssh  2005-08-22 13:27:39.000000000 +0200
@@ -1,4 +1,14 @@
 #! /bin/sh
+### BEGIN INIT INFO
+# Provides:          sshd
+# Required-Start:    $network $syslog
+# Required-Stop:     $network $syslog
+# Default-Start:     1 2 3 4 5
+# Default-Stop:      S 0 6
+# Short-Description: 
+# Description:       
+### END INIT INFO
+
 set -e
 
 # /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon
diff -u /etc/init.d/stop-bootlogd init.d/stop-bootlogd
--- /etc/init.d/stop-bootlogd   2005-01-04 23:43:18.000000000 +0100
+++ init.d/stop-bootlogd        2005-08-22 14:27:23.000000000 +0200
@@ -1,4 +1,13 @@
 #! /bin/sh
+### BEGIN INIT INFO
+# Provides:          bootlogd
+# Required-Start:    mountvirtfs
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 #
 # bootlogd     One of the first scripts to be executed. Starts or stops
 #              the bootlogd log program. If this script is called as
diff -u /etc/init.d/sysklogd init.d/sysklogd
--- /etc/init.d/sysklogd        2004-11-07 13:13:43.000000000 +0100
+++ init.d/sysklogd     2005-08-22 13:27:47.000000000 +0200
@@ -1,5 +1,14 @@
 #! /bin/sh
 # /etc/init.d/sysklogd: start the system log daemon.
+### BEGIN INIT INFO
+# Provides:          syslog sysklogd
+# Required-Start:    $network
+# Required-Stop:     $network
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: start the system log daemon
+# Description:       multiline_description
+### END INIT INFO
 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
diff -u /etc/init.d/udev init.d/udev
--- /etc/init.d/udev    2005-05-29 19:35:00.000000000 +0200
+++ init.d/udev 2005-08-22 14:23:54.000000000 +0200
@@ -1,4 +1,13 @@
 #!/bin/sh -e
+### BEGIN INIT INFO
+# Provides:          udev
+# Required-Start:    mountvirtfs
+# Required-Stop:     
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      6
+# Short-Description: 
+# Description:       
+### END INIT INFO
 
 PATH="/sbin:/bin"
 
diff -u /etc/init.d/udev-mtab init.d/udev-mtab
--- /etc/init.d/udev-mtab       2005-05-29 19:35:06.000000000 +0200
+++ init.d/udev-mtab    2005-08-23 00:42:43.000000000 +0200
@@ -1,5 +1,15 @@
 #!/bin/sh -e
 # add to /etc/mtab the entries for /dev and /dev/.static/dev
+### BEGIN INIT INFO
+# Provides:          udev-mtab
+# Required-Start:    $local_fs
+# Required-Stop:     $local_fs
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: manage network interfaces
+# Description:       manage network interfaces and configure some networking
+#                    options
+### END INIT INFO
 
 # if it's not, it's probably a symlink to /proc/mounts
 [ -w /etc/mtab ] || exit 0
diff -u /etc/init.d/umountfs init.d/umountfs
--- /etc/init.d/umountfs        2004-09-10 17:00:48.000000000 +0200
+++ init.d/umountfs     2005-08-22 13:27:47.000000000 +0200
@@ -4,6 +4,15 @@
 #
 # Version:      @(#)umountfs  2.85-16  03-Jun-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          umountfs
+# Required-Start:    
+# Required-Stop: 
+# Default-Start:      6
+# Default-Stop:       
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
diff -u /etc/init.d/umountnfs.sh init.d/umountnfs.sh
--- /etc/init.d/umountnfs.sh    2004-09-10 17:00:48.000000000 +0200
+++ init.d/umountnfs.sh 2005-08-22 13:27:47.000000000 +0200
@@ -8,6 +8,15 @@
 #
 # Version:      @(#)umountnfs  2.85-23  29-Jul-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          umountnfs
+# Required-Start:    
+# Required-Stop: 
+# Default-Start:      6
+# Default-Stop:       
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
diff -u /etc/init.d/urandom init.d/urandom
--- /etc/init.d/urandom 2004-09-10 17:00:48.000000000 +0200
+++ init.d/urandom      2005-08-23 00:44:35.000000000 +0200
@@ -5,6 +5,15 @@
 #
 # Version:     @(#)urandom  2.85-14  31-Mar-2004  [EMAIL PROTECTED]
 #
+### BEGIN INIT INFO
+# Provides:          urandom
+# Required-Start:    $time
+# Required-Stop: 
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
 
 [ -c /dev/urandom ] || exit 0
 
diff -u /etc/init.d/xdebconfigurator init.d/xdebconfigurator
--- /etc/init.d/xdebconfigurator        2005-08-21 23:58:29.000000000 +0200
+++ init.d/xdebconfigurator     2005-08-22 14:45:14.000000000 +0200
@@ -2,11 +2,11 @@
 # /etc/init.d/xdebconfigurator
 #
 ### BEGIN INIT INFO
-# Provides:          xdebconfigurator
-# Required-Start:    $syslog
-# Required-Stop:     $syslog
-# Should-Start:      2 3 4 5
-# Should-Stop:       0 1 6
+# provides:          xdebconfigurator
+# required-start:    $syslog
+# required-stop:     $syslog
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:      0 6
 # Short-Description: Genererate xfree86 configuration at boot time
 # Description:       Preseed X configuration and use dexconf to 
 #                    genereate a new configuration file.
diff -u /etc/init.d/xfree86-common init.d/xfree86-common
--- /etc/init.d/xfree86-common  2005-02-11 08:11:05.000000000 +0100
+++ init.d/xfree86-common       2005-08-22 13:27:47.000000000 +0200
@@ -1,4 +1,14 @@
 #!/bin/sh
+### BEGIN INIT INFO
+# Provides:          xfree86-common
+# Required-Start:    $local_fs
+# Required-Stop:     $local_fs
+# Default-Start:      S 1 2 3 4 5
+# Default-Stop:       0 6
+# Short-Description: 
+# Description: 
+### END INIT INFO
+
 
 # $Id: xfree86-common.init 2186 2005-02-11 07:11:05Z branden $
 


_______________________________________________
initscripts-ng-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/initscripts-ng-devel

Reply via email to