]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[main] Allow splash to be specified from grub
authorRay Strode <rstrode@redhat.com>
Fri, 7 Aug 2009 19:09:18 +0000 (15:09 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 7 Aug 2009 19:09:18 +0000 (15:09 -0400)
We now check the splash from the kernel command line.
This allows initrds to ship a few splashes at once and
make it changeable at boot time.

src/main.c

index 0db010d65aa6dd70bf908da9015f81e500a56974..a496450e5ecd1254ff7c844badc8d9dd4ead4d0c 100644 (file)
@@ -103,6 +103,7 @@ typedef struct
   uint32_t should_retain_splash : 1;
 
   char *console;
+  char *override_splash_path;
 
   int number_of_errors;
 } state_t;
@@ -186,6 +187,34 @@ show_detailed_splash (state_t *state)
     }
 }
 
+static void
+find_override_splash (state_t *state)
+{
+  char *splash_string;
+
+  if (state->override_splash_path != NULL)
+      return;
+
+  splash_string = strstr (state->kernel_command_line, "plymouth:splash=");
+
+  if (splash_string != NULL)
+    {
+      char *end;
+      splash_string = strdup (splash_string + strlen ("plymouth:splash="));
+
+      end = strstr (splash_string, " ");
+
+      if (end != NULL)
+        *end = '\0';
+
+      ply_trace ("Splash is configured to be '%s'", splash_string);
+
+      asprintf (&state->override_splash_path,
+                PLYMOUTH_THEME_PATH "%s/%s.plymouth",
+                splash_string, splash_string);
+    }
+}
+
 static void
 show_default_splash (state_t *state)
 {
@@ -193,8 +222,20 @@ show_default_splash (state_t *state)
     return;
 
   ply_trace ("Showing splash screen");
-  state->boot_splash = start_boot_splash (state,
-                                          PLYMOUTH_THEME_PATH "default.plymouth");
+  find_override_splash (state);
+  if (state->override_splash_path != NULL)
+    {
+      ply_trace ("Starting override splash at '%s'", state->override_splash_path);
+      state->boot_splash = start_boot_splash (state,
+                                              state->override_splash_path);
+    }
+
+  if (state->boot_splash == NULL)
+    {
+      ply_trace ("Starting default splash");
+      state->boot_splash = start_boot_splash (state,
+                                              PLYMOUTH_THEME_PATH "default.plymouth");
+    }
 
   if (state->boot_splash == NULL)
     {