From 65359860797396cef8efcb33a36442d87fb9342a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Date: Fri, 7 Apr 2017 10:01:16 -0400 Subject: [PATCH] main: Look for theme in runtime dir first MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When a theme is shipped exclusively in the initrd, plymouth will not be able to load is if it starts the boot splash after the bootup process already switched from the initrd. One way to make it work is to copy the theme to plymouth's runtime directory in /run, which is preserved during switch root. This commit changes the routine which resolves a theme's path to have it look first in themes/ under plymouth's runtime directory. Signed-off-by: João Paulo Rechi Vita --- configure.ac | 3 +++ src/Makefile.am | 3 ++- src/main.c | 20 ++++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d145c695..b6fcfd84 100644 --- a/configure.ac +++ b/configure.ac @@ -269,6 +269,9 @@ PLYMOUTH_CFLAGS="$PLYMOUTH_CFLAGS $WARN_CFLAGS" plymouththemedir=$datadir/plymouth/themes AS_AC_EXPAND(PLYMOUTH_THEME_PATH, $plymouththemedir) +plymouthruntimethemedir=$plymouthruntimedir/themes +AS_AC_EXPAND(PLYMOUTH_RUNTIME_THEME_PATH, $plymouthruntimethemedir) + plymouthplugindir=$libdir/plymouth/ AS_AC_EXPAND(PLYMOUTH_PLUGIN_PATH, $plymouthplugindir) diff --git a/src/Makefile.am b/src/Makefile.am index ceb72ba1..95ed0192 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,7 +20,8 @@ plymouthd_CFLAGS = $(PLYMOUTH_CFLAGS) \ -DPLYMOUTH_THEME_PATH=\"$(PLYMOUTH_THEME_PATH)/\" \ -DPLYMOUTH_POLICY_DIR=\"$(PLYMOUTH_POLICY_DIR)/\" \ -DPLYMOUTH_RUNTIME_DIR=\"$(PLYMOUTH_RUNTIME_DIR)\" \ - -DPLYMOUTH_CONF_DIR=\"$(PLYMOUTH_CONF_DIR)/\" + -DPLYMOUTH_CONF_DIR=\"$(PLYMOUTH_CONF_DIR)/\" \ + -DPLYMOUTH_RUNTIME_THEME_PATH=\"$(PLYMOUTH_RUNTIME_THEME_PATH)/\" plymouthd_LDADD = $(PLYMOUTH_LIBS) libply/libply.la libply-splash-core/libply-splash-core.la plymouthd_SOURCES = \ ply-boot-protocol.h \ diff --git a/src/main.c b/src/main.c index 02e0082b..50d19210 100644 --- a/src/main.c +++ b/src/main.c @@ -311,8 +311,16 @@ load_settings (state_t *state, goto out; asprintf (theme_path, - PLYMOUTH_THEME_PATH "%s/%s.plymouth", + PLYMOUTH_RUNTIME_THEME_PATH "%s/%s.plymouth", splash_string, splash_string); + ply_trace ("Checking if %s exists", *theme_path); + if (!ply_file_exists (*theme_path)) { + ply_trace ("%s not found, fallbacking to " PLYMOUTH_THEME_PATH, + *theme_path); + asprintf (theme_path, + PLYMOUTH_THEME_PATH "%s/%s.plymouth", + splash_string, splash_string); + } if (isnan (state->splash_delay)) { const char *delay_string; @@ -427,8 +435,16 @@ find_override_splash (state_t *state) ply_trace ("Splash is configured to be '%*.*s'", length, length, splash_string); asprintf (&state->override_splash_path, - PLYMOUTH_THEME_PATH "%*.*s/%*.*s.plymouth", + PLYMOUTH_RUNTIME_THEME_PATH "%*.*s/%*.*s.plymouth", length, length, splash_string, length, length, splash_string); + ply_trace ("Checking if %s exists", state->override_splash_path); + if (!ply_file_exists (state->override_splash_path)) { + ply_trace ("%s not found, fallbacking to " PLYMOUTH_THEME_PATH, + state->override_splash_path); + asprintf (&state->override_splash_path, + PLYMOUTH_THEME_PATH "%*.*s/%*.*s.plymouth", + length, length, splash_string, length, length, splash_string); + } } if (isnan (state->splash_delay)) { -- 2.47.3