From: João Paulo Rechi Vita Date: Fri, 7 Apr 2017 14:01:16 +0000 (-0400) Subject: main: Look for theme in runtime dir first X-Git-Tag: 0.9.3~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65359860797396cef8efcb33a36442d87fb9342a;p=thirdparty%2Fplymouth.git main: Look for theme in runtime dir first 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 --- 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)) {