diff mbox series

[2/2] sysvinit: rc: improve counting of progress steps

Message ID d3cf81007124c572c2010e785d421a0d2df9b619.1787734737.git.nora.schiffer@ew.tq-group.com
State New
Headers show
Series [1/2] sysvinit: rc: fix inconsistent indentation | expand

Commit Message

Nora Schiffer Aug. 26, 2026, 9 a.m. UTC
Fix a number of issues that caused more steps to be counted than calls
to startup_progress would happen in some situations, resulting in the
progress bar never reaching 100%:

- Use the same conditions when looping over initscripts for counting
  steps that are also used for running them
- When skipping a script, run startup_progress to avoid off-by-one

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
---
 meta/recipes-core/sysvinit/sysvinit/rc | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index f1169ec3ac..d66a7cf1b0 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -116,8 +116,18 @@  then
 	esac
 
 	num_steps=0
-	for s in /etc/rc$runlevel.d/[SK]*; do
-		case "${s##/etc/rc$runlevel.d/S??}" in
+	if [ $previous != N ]
+	then
+		for i in /etc/rc$runlevel.d/K[0-9][0-9]*
+		do
+			[ ! -f $i ] && continue
+			num_steps=$(($num_steps + 1))
+		done
+	fi
+	for i in /etc/rc$runlevel.d/S*
+	do
+		[ ! -f $i ] && continue
+		case "${i##/etc/rc$runlevel.d/S??}" in
 			gdm|xdm|kdm|reboot|halt)
 				break
 				;;
@@ -158,7 +168,11 @@  then
 			# and _no_ stop script in this level, we don't
 			# have to re-start the service.
 			#
-			[ -f $previous_start ] && [ ! -f $stop ] && continue
+			if [ -f $previous_start ] && [ ! -f $stop ]
+			then
+				startup_progress
+				continue
+			fi
 		fi
 		if [ x"${PSPLASH_TEXT_UPDATES}" = x"yes" ]; then
 			psplash-write "MSG $(basename $i .sh | cut -c 4-)" || true