aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2010-05-19 12:08:02 -0400
committerBill Nottingham <notting@redhat.com>2010-05-19 12:08:02 -0400
commit9d1c6c1e3bf176d3f89de4ec5551f9960c4986ed (patch)
treeb581ab6d5390fd90da37fe2b4c524364368c8e97
parentd8b2a0ee8b96925295e6f9cbfe41e5e55e0727a8 (diff)
downloadinitscripts-9d1c6c1e3bf176d3f89de4ec5551f9960c4986ed.tar
initscripts-9d1c6c1e3bf176d3f89de4ec5551f9960c4986ed.tar.gz
initscripts-9d1c6c1e3bf176d3f89de4ec5551f9960c4986ed.tar.bz2
initscripts-9d1c6c1e3bf176d3f89de4ec5551f9960c4986ed.tar.xz
initscripts-9d1c6c1e3bf176d3f89de4ec5551f9960c4986ed.zip
Improve shutdown splash screen reliability
Right now the splash screen and rc script are racing with each other so you occasionally see a few shutdown messages before plymouth is up. This commit ensures proper synchronization between prefdm, plymouthd, and the rc script. It does this by 1) fully stopping prefdm before letting rc start 2) fully starting plymouth before letting rc start 3) if prefdm is running (e.g. runlevel 5), waiting until it is fully stopped before starting plymouthd 4) if prefdm is not running (e.g. runlevel 3), starting plymouthd right away One bit of complication in this commit is the "splash manager". It's a layer of indirection needed to handle the conditional mentioned in 3) and 4). There's no way within an upstart job file to say "start after the prefdm "stopped" event only if prefdm is not already stopped". We really need this to effectively happen, though, because if prefdm isn't in the process of stopping (because it was never started in the first place), it will never emit the stopped event and blocking for an event that never comes mean shutdown would never start. The splash manager checks if prefdm is already running and uses that information to emit an appropriate event that the plymouth-shutdown job can key of off. Note, one implication of 4) is we are showing plymouth when shutting down from runlevel 3 now. This is a change in behavior, but makes sense, since we show plymouth when starting up into runlevel 3.
-rw-r--r--init/plymouth-shutdown.conf17
-rw-r--r--init/prefdm.conf2
-rw-r--r--init/splash-manager.conf23
3 files changed, 28 insertions, 14 deletions
diff --git a/init/plymouth-shutdown.conf b/init/plymouth-shutdown.conf
index e251286f..49010848 100644
--- a/init/plymouth-shutdown.conf
+++ b/init/plymouth-shutdown.conf
@@ -3,23 +3,14 @@
# This service triggers plymouth to put up a splash
# when leaving runlevel 5.
-start on stopped prefdm
-task
+start on (splash-request IMMEDIATE=1) or (splash-request and stopped prefdm)
+task
console output
script
- set $(runlevel || true)
- if [ "$2" != "0" ] && [ "$2" != "6" ]; then
- exit 0
- fi
-
- /sbin/plymouthd --mode=shutdown || exit 1
+ /sbin/plymouthd --mode="$MODE" || exit 1
/bin/plymouth --sysinit
/bin/plymouth --show-splash
- if [ "$2" = "0" ]; then
- /bin/plymouth message --text="Shutting down..."
- elif [ "$2" = "6" ]; then
- /bin/plymouth message --text="Restarting..."
- fi
+ /bin/plymouth message --text="$MESSAGE"
end script
diff --git a/init/prefdm.conf b/init/prefdm.conf
index d47356c7..701b8065 100644
--- a/init/prefdm.conf
+++ b/init/prefdm.conf
@@ -4,7 +4,7 @@
start on stopped rc RUNLEVEL=5
-stop on runlevel [!5]
+stop on starting rc RUNLEVEL=[!5]
console output
respawn
diff --git a/init/splash-manager.conf b/init/splash-manager.conf
new file mode 100644
index 00000000..8e3299cf
--- /dev/null
+++ b/init/splash-manager.conf
@@ -0,0 +1,23 @@
+# splash-manager - requests splash screen
+#
+# This service emits a splash-request event when
+# its time to put up the plymouth splash
+
+start on starting rc RUNLEVEL=[06]
+task
+
+console output
+script
+ if [ "$RUNLEVEL" = "0" ]; then
+ MESSAGE=$"Shutting down..."
+ elif [ "$RUNLEVEL" = "6" ]; then
+ MESSAGE=$"Restarting..."
+ fi
+ initctl status prefdm 2>/dev/null > /tmp/cowcow
+ if cat /tmp/cowcow | grep -q stop/waiting; then
+ initctl emit splash-request IMMEDIATE=1 MODE=shutdown MESSAGE="$MESSAGE"
+ else
+ initctl emit splash-request MODE=shutdown MESSAGE="$MESSAGE"
+ fi
+end script
+