]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add --wait option to client to block until daemon quits
authorCasey Dahlin <cdahlin@redhat.com>
Tue, 5 Aug 2008 19:41:46 +0000 (15:41 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 5 Aug 2008 20:26:27 +0000 (16:26 -0400)
src/client/plymouth.c

index 3e332a88806fcbe9871a7caf87d830c5012b9dde..37606d982ff2f5ad8d58102087b7e244a9c7225e 100644 (file)
@@ -125,8 +125,21 @@ on_success (state_t *state)
 static void
 on_disconnect (state_t *state)
 {
-  ply_error ("error: unexpectedly disconnected from boot status daemon");
-  ply_event_loop_exit (state->loop, 2);
+  bool wait;
+  int status = 0;
+
+  wait = false;
+  ply_command_parser_get_options (state->command_parser,
+                                   "wait", &wait,
+                                   NULL
+                                  );
+
+  if (! wait) {
+      ply_error ("error: unexpectedly disconnected from boot status daemon");
+      status = 2;
+  }
+
+  ply_event_loop_exit (state->loop, status);
 }
 
 static void
@@ -161,7 +174,7 @@ main (int    argc,
       char **argv)
 {
   state_t state = { 0 };
-  bool should_help, should_quit, should_ping, should_sysinit, should_ask_for_password, should_show_splash, should_hide_splash;
+  bool should_help, should_quit, should_ping, should_sysinit, should_ask_for_password, should_show_splash, should_hide_splash, should_wait;
   char *status, *chroot_dir;
   int exit_code;
 
@@ -181,6 +194,7 @@ main (int    argc,
                                   "hide-splash", "Hide splash screen", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "ask-for-password", "Ask user for password", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "update", "Tell boot daemon an update about boot progress", PLY_COMMAND_OPTION_TYPE_STRING,
+                                  "wait", "Wait for boot daemon to quit", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   NULL);
 
   ply_command_parser_add_command (state.command_parser,
@@ -212,6 +226,7 @@ main (int    argc,
                                   "hide-splash", &should_hide_splash,
                                   "ask-for-password", &should_ask_for_password,
                                   "update", &status,
+                                  "wait", &should_wait,
                                   NULL);
 
   if (should_help || argc < 2)
@@ -304,6 +319,8 @@ main (int    argc,
                                    on_success,
                                    (ply_boot_client_response_handler_t)
                                    on_failure, &state);
+  else if (should_wait)
+    {} // Do nothing
 
   exit_code = ply_event_loop_run (state.loop);