mirror of
https://git.yoctoproject.org/poky
synced 2026-05-09 05:29:32 +00:00
sysvinit: Add psplash support, remove elpp support, convert rcS to use rc, speedup execution of sh scripts
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@771 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
@@ -18,18 +18,37 @@
|
|||||||
. /etc/default/rcS
|
. /etc/default/rcS
|
||||||
export VERBOSE
|
export VERBOSE
|
||||||
|
|
||||||
|
startup_progress() {
|
||||||
|
step=$(($step + $step_change))
|
||||||
|
progress=$(($step * $progress_size / $num_steps + $first_step))
|
||||||
|
if type psplash-write >/dev/null 2>&1; then
|
||||||
|
TMPDIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Start script or program.
|
# Start script or program.
|
||||||
#
|
#
|
||||||
startup() {
|
startup() {
|
||||||
|
# Handle verbosity
|
||||||
|
[ "$VERBOSE" = very ] && echo "INIT: Running $@..."
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
*.sh)
|
*.sh)
|
||||||
sh "$@"
|
# Source shell script for speed.
|
||||||
|
(
|
||||||
|
trap - INT QUIT TSTP
|
||||||
|
scriptname=$1
|
||||||
|
shift
|
||||||
|
. $scriptname
|
||||||
|
)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
"$@"
|
"$@"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
startup_progress
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
|
# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
|
||||||
@@ -56,6 +75,37 @@ startup() {
|
|||||||
# Is there an rc directory for this new runlevel?
|
# Is there an rc directory for this new runlevel?
|
||||||
if [ -d /etc/rc$runlevel.d ]
|
if [ -d /etc/rc$runlevel.d ]
|
||||||
then
|
then
|
||||||
|
# Find out where in the progress bar the initramfs got to.
|
||||||
|
PROGRESS_STATE=0
|
||||||
|
#if [ -f /dev/.initramfs/progress_state ]; then
|
||||||
|
# . /dev/.initramfs/progress_state
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Split the remaining portion of the progress bar into thirds
|
||||||
|
progress_size=$(((100 - $PROGRESS_STATE) / 3))
|
||||||
|
|
||||||
|
case "$runlevel" in
|
||||||
|
0|6)
|
||||||
|
# Count down from 0 to -100 and use the entire bar
|
||||||
|
first_step=0
|
||||||
|
progress_size=100
|
||||||
|
step_change=-1
|
||||||
|
;;
|
||||||
|
S)
|
||||||
|
# Begin where the initramfs left off and use 2/3
|
||||||
|
# of the remaining space
|
||||||
|
first_step=$PROGRESS_STATE
|
||||||
|
progress_size=$(($progress_size * 2))
|
||||||
|
step_change=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Begin where rcS left off and use the final 1/3 of
|
||||||
|
# the space (by leaving progress_size unchanged)
|
||||||
|
first_step=$(($progress_size * 2 + $PROGRESS_STATE))
|
||||||
|
step_change=1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# First, run the KILL scripts.
|
# First, run the KILL scripts.
|
||||||
if [ $previous != N ]
|
if [ $previous != N ]
|
||||||
then
|
then
|
||||||
@@ -68,6 +118,19 @@ startup() {
|
|||||||
startup $i stop
|
startup $i stop
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
num_steps=0
|
||||||
|
for s in /etc/rc$runlevel.d/[SK]*; do
|
||||||
|
case "${s##/etc/rc$runlevel.d/S??}" in
|
||||||
|
gdm|xdm|kdm|reboot|halt)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
num_steps=$(($num_steps + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
step=0
|
||||||
|
|
||||||
# Now run the START scripts for this runlevel.
|
# Now run the START scripts for this runlevel.
|
||||||
for i in /etc/rc$runlevel.d/S*
|
for i in /etc/rc$runlevel.d/S*
|
||||||
do
|
do
|
||||||
@@ -99,4 +162,10 @@ startup() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# eof /etc/init.d/rc
|
|
||||||
|
if [ "x$runlevel" != "xS" ]; then
|
||||||
|
if type psplash-write >/dev/null 2>&1; then
|
||||||
|
TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
|
||||||
|
umount /mnt/.psplash
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|||||||
@@ -35,64 +35,10 @@ fi
|
|||||||
#
|
#
|
||||||
trap ":" INT QUIT TSTP
|
trap ":" INT QUIT TSTP
|
||||||
|
|
||||||
#
|
|
||||||
# Do we have /proc/progress and set VERBOSE to "no" ?
|
|
||||||
# If so, calculate the number of scripts and the incremental step
|
|
||||||
#
|
|
||||||
if [ "$VERBOSE" = no ]; then
|
|
||||||
if [ -e /proc/progress ]; then
|
|
||||||
set `ls -1 /etc/rc$runlevel.d/S* | wc`
|
|
||||||
numscripts=$1
|
|
||||||
PROGRESS_incstep=`expr 90 / $1`
|
|
||||||
PROGRESS_value=10
|
|
||||||
PROGRESS=yes
|
|
||||||
export PROGRESS_value PROGRESS_incstep
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
export VERBOSE PROGRESS
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Call all parts in order.
|
# Call all parts in order.
|
||||||
#
|
#
|
||||||
for i in /etc/rcS.d/S??*
|
exec /etc/init.d/rc S
|
||||||
do
|
|
||||||
# Ignore dangling symlinks for now.
|
|
||||||
[ ! -f "$i" ] && continue
|
|
||||||
|
|
||||||
# Handle verbosity
|
|
||||||
[ "$VERBOSE" = very ] && echo "INIT: Running $i..."
|
|
||||||
if [ "$PROGRESS" = yes ]; then
|
|
||||||
export PROGRESS_value=`expr $PROGRESS_value + $PROGRESS_incstep`
|
|
||||||
echo "$PROGRESS_value Starting $i..." >/proc/progress
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
#
|
|
||||||
# Report status based on result code
|
|
||||||
#
|
|
||||||
result=$?
|
|
||||||
if [ "$PROGRESS" = yes ]; then
|
|
||||||
if [ "$result" = 0 ]; then
|
|
||||||
echo "=s" >/proc/progress
|
|
||||||
else
|
|
||||||
echo "=f" >/proc/progress
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# For compatibility, run the files in /etc/rc.boot too.
|
# For compatibility, run the files in /etc/rc.boot too.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ DESCRIPTION = "System-V like init."
|
|||||||
SECTION = "base"
|
SECTION = "base"
|
||||||
LICENSE = "GPL"
|
LICENSE = "GPL"
|
||||||
HOMEPAGE = "http://freshmeat.net/projects/sysvinit/"
|
HOMEPAGE = "http://freshmeat.net/projects/sysvinit/"
|
||||||
PR = "r24"
|
PR = "r26"
|
||||||
|
|
||||||
# USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
|
# USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
|
||||||
# Set PACKAGE_ARCH appropriately.
|
# Set PACKAGE_ARCH appropriately.
|
||||||
|
|||||||
Reference in New Issue
Block a user