[Pkg-sysvinit-commits] r799 - in sysvinit/trunk/debian: . initscripts/etc/init.d sysv-rc/etc/init.d

Petter Reinholdtsen pere at costa.debian.org
Fri Jul 14 13:04:03 UTC 2006


Author: pere
Date: 2006-07-14 13:03:55 +0000 (Fri, 14 Jul 2006)
New Revision: 799

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs
   sysvinit/trunk/debian/sysv-rc/etc/init.d/rc
Log:
  * Update progress bar changes in init.d/sendsigs and init.d/rc.
    Patch from Ubuntu.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2006-07-14 12:02:44 UTC (rev 798)
+++ sysvinit/trunk/debian/changelog	2006-07-14 13:03:55 UTC (rev 799)
@@ -22,6 +22,8 @@
     when /usr/bin/on_ac_power is unavailable. (Closes: #367867)
   * Change runlevel manpage to be less misleading.  Patch from Ubuntu.
   * Change messages from init.d/sendsigs.  Based on patch from Ubuntu.
+  * Update progress bar changes in init.d/sendsigs and init.d/rc.
+    Patch from Ubuntu.
   * Acknoledge NMU.  Thanks, Steinar H. Gunderson . (Closes: #359176)
 
   [ Thomas Hood ]

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs	2006-07-14 12:02:44 UTC (rev 798)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs	2006-07-14 13:03:55 UTC (rev 799)
@@ -24,6 +24,23 @@
 	log_action_end_msg 0
 }
 
+splash_back() {
+    # Restore usplash if it was enabled and killed by do_stop
+    for x in $(cat /proc/cmdline); do
+	case $x in
+	splash*)
+            SPLASH=true;
+            ;;
+	esac
+    done
+
+    [ "$SPLASH" = "true" ] || return 0
+
+    if [ -x /sbin/usplash ]; then
+        /sbin/usplash -c &
+    fi
+}
+
 case "$1" in
   start)
 	# No-op
@@ -34,6 +51,7 @@
 	;;
   stop)
 	do_stop
+	splash_back
 	;;
   *)
 	echo "Usage: $0 start|stop" >&2

Modified: sysvinit/trunk/debian/sysv-rc/etc/init.d/rc
===================================================================
--- sysvinit/trunk/debian/sysv-rc/etc/init.d/rc	2006-07-14 12:02:44 UTC (rev 798)
+++ sysvinit/trunk/debian/sysv-rc/etc/init.d/rc	2006-07-14 13:03:55 UTC (rev 799)
@@ -70,6 +70,18 @@
 export VERBOSE
 
 #
+# Stub to do progress bar ticks (currently just for usplash) on startup
+#
+startup_progress() {
+    $@
+    step=$(($step + $step_change))
+    progress=$(($step * $progress_size / $num_steps + $first_step))
+    if type usplash_write >/dev/null 2>&1; then
+        usplash_write "PROGRESS $progress" || true
+    fi
+}
+
+#
 # Start script or program.
 #
 case "$CONCURRENCY" in
@@ -89,14 +101,14 @@
 				if [ "." = "$sh" ] ; then
 					set "$action"
 					RC_SAVE_PATH="$PATH"
-					$debug . "$script"
+					startup_progress $debug . "$script"
 					PATH="$RC_SAVE_PATH"
 				else
-					$debug $sh "$script" $action
+					startup_progress $debug $sh "$script" $action
 				fi
 				;;
 			  *)
-				$debug "$script" $action
+				startup_progress $debug "$script" $action
 				;;
 			esac
 		done
@@ -119,14 +131,14 @@
 				if [ "." = "$sh" ] ; then
 					set "$action"
 					RC_SAVE_PATH="$PATH"
-					$debug . "$script"
+					startup_progress $debug . "$script"
 					PATH="$RC_SAVE_PATH"
 				else
-					$debug $sh "$script" $action
+					startup_progress $debug $sh "$script" $action
 				fi
 				;;
 			  *)
-				$debug "$script" $action &
+				startup_progress $debug "$script" $action &
 				backgrounded=1
 				;;
 			esac
@@ -152,7 +164,7 @@
 				  *.sh)
 					set "$action"
 					RC_SAVE_PATH="$PATH"
-					$debug . "$script"
+					startup_progress $debug . "$script"
 					PATH="$RC_SAVE_PATH"
 					;;
 				  *)
@@ -164,7 +176,7 @@
 		fi
 
 		# startpar is not working as it should yet [pere 2005-09-10]
-		[ -n "$scripts" ] && $debug startpar -a $action $scripts
+		[ -n "$scripts" ] && startup_progress $debug startpar -a $action $scripts
 	}
 	;;
 esac
@@ -172,6 +184,53 @@
 # Is there an rc directory for this new runlevel?
 if [ -d /etc/rc$runlevel.d ]
 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)
+			ACTION=stop
+			# Count down from 0 to -100 and use the entire bar
+			first_step=0
+			progress_size=100
+			step_change=-1
+			;;
+	        S)
+		        ACTION=start
+			# 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
+			;;
+		*)
+			ACTION=start
+			# 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
+
+	# Count the number of scripts we need to run (for usplash progress bar)
+	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
+
 	# First, run the KILL scripts.
 	if [ "$previous" != N ]
 	then
@@ -212,38 +271,6 @@
 		done
 	fi
 
-	case "$runlevel" in
-	  0|6)
-		ACTION=stop
-		first_step=100
-		progress_size=100
-		step_change=-1
-		;;
-	  S)
-		ACTION=start
-		first_step=0
-		progress_size=100
-		step_change=1
-		;;
-	  *)
-		ACTION=start
-		first_step=0
-		progress_size=100
-		step_change=1
-		;;
-	esac
-
-	# Count the number of scripts we need to run (for usplash progress bar)
-	num_steps=0
-	for s in /etc/rc$runlevel.d/S*; do
-		num_steps=$(($num_steps + 1))
-		case "${s##/etc/rc$runlevel.d/S??}" in
-		  gdm|xdm|kdm)
-			break
-			;;
-		esac
-	done
-
 	# Now run the START scripts for this runlevel.
 	# Run all scripts with the same level in parallel
 	CURLEVEL=""
@@ -280,14 +307,6 @@
 			SCRIPTS="$SCRIPTS $i"
 		done
 		startup $ACTION $SCRIPTS
-
-		# Use 50% of the progress bar for rcS and the rest for the
-		# runlevel we want to end up in
-		step=$(($step + $step_change))
-		progress=$(($step * $progress_size / $num_steps + $first_step))
-		if type usplash_write >/dev/null 2>&1; then
-			usplash_write "PROGRESS $progress" || true
-		fi
 	done
 fi
 




More information about the Pkg-sysvinit-commits mailing list