]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: Look for theme in runtime dir first
authorJoão Paulo Rechi Vita <jprvita@gmail.com>
Fri, 7 Apr 2017 14:01:16 +0000 (10:01 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 7 Apr 2017 15:43:45 +0000 (11:43 -0400)
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 <jprvita@endlessm.com>
configure.ac
src/Makefile.am
src/main.c

index d145c695c619b902a58354c39b90a23b57b82c3a..b6fcfd8414ea91e9e7191e1ab3b0a0c9c619830c 100644 (file)
@@ -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)
 
index ceb72ba130d0452f54373a1a1cf594cb221b3776..95ed019265ec77a114a1b7242d6290193f2a34d8 100644 (file)
@@ -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                                        \
index 02e0082b35b81214dceecee6beddaa874373a6e4..50d192106f48e01b9f321329497e910656312a9d 100644 (file)
@@ -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)) {