]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[client] Run ask-for-password command unconditionally
authorRay Strode <rstrode@redhat.com>
Mon, 25 Jan 2010 22:07:56 +0000 (17:07 -0500)
committerRay Strode <rstrode@redhat.com>
Tue, 26 Jan 2010 06:20:00 +0000 (01:20 -0500)
Even if we can't contact the daemon, we should still run the
ask-for-password command.  This is because the command may
do things important for boot up to continue like unlocking
the root partition.

src/client/plymouth.c

index c00dddaea9cb9f4bbb663a443dbb56a610fbf2b8..657feb01785f76386b996447102d7b5b5f60cec9 100644 (file)
@@ -186,9 +186,48 @@ on_success (state_t *state)
 }
 
 static void
-on_password_answer_failure (password_answer_state_t *answer_state, ply_boot_client_t *client)
+on_password_answer_failure (password_answer_state_t *answer_state,
+                            ply_boot_client_t       *client)
 {
-  ply_event_loop_exit (answer_state->state->loop, 1);
+  /* plymouthd isn't running for some reason.  If there is a command
+   * to run, we'll run it anyway, because it might be important for
+   * boot up to continue (to decrypt the root partition or whatever)
+   */
+  if (answer_state->command != NULL)
+    {
+      int exit_status;
+      bool command_started;
+
+      exit_status = 127;
+      command_started = false;
+      while (answer_state->number_of_tries_left > 0)
+        {
+          command_started = answer_via_command (answer_state->command, NULL,
+                                                &exit_status);
+
+          if (command_started && WIFEXITED (exit_status) &&
+              WEXITSTATUS (exit_status) == 0)
+            {
+              break;
+            }
+
+          answer_state->number_of_tries_left--;
+        }
+
+      if (command_started && WIFSIGNALED (exit_status))
+        {
+          raise (WTERMSIG (exit_status));
+        }
+      else
+        {
+          ply_event_loop_exit (answer_state->state->loop,
+                               WEXITSTATUS (exit_status));
+        }
+    }
+  else
+    {
+      ply_event_loop_exit (answer_state->state->loop, 1);
+    }
 }
 
 static void