diff options
-rwxr-xr-x | scripts/plymouth-update-initrd | 2 | ||||
-rw-r--r-- | src/client/ply-boot-client.c | 12 | ||||
-rw-r--r-- | src/client/ply-boot-client.h | 6 | ||||
-rw-r--r-- | src/client/plymouth.c | 15 | ||||
-rw-r--r-- | src/main.c | 45 | ||||
-rw-r--r-- | src/ply-boot-protocol.h | 1 | ||||
-rw-r--r-- | src/ply-boot-server.c | 16 | ||||
-rw-r--r-- | src/ply-boot-server.h | 4 |
8 files changed, 77 insertions, 24 deletions
diff --git a/scripts/plymouth-update-initrd b/scripts/plymouth-update-initrd index bb3343a..99032ae 100755 --- a/scripts/plymouth-update-initrd +++ b/scripts/plymouth-update-initrd @@ -31,7 +31,7 @@ TMPDIR="$(mktemp -d $PWD/initrd.XXXXXXXXXX)" (cd $TMPDIR zcat $INITRD | cpio --quiet -Hnewc -i --make-directories sed -i -e 's@^#!\(.*\)@#!/bin/plymouthd \1\n@' init - #sed -i -e 's@setquiet@&\n/bin/plymouth --ask-for-password@' init + sed -i -e 's@setquiet@&\n/bin/plymouth --show-splash@' init (cd $LIBDIR DEPS=$(get_lib_deps ${LIBEXECDIR}/plymouth/plymouth ${LIBDIR}/plymouth/fedora-fade-in.so ${LIBDIR}/plymouth/text.so ${LIBDIR}/plymouth/details.so) for dep in $DEPS; do diff --git a/src/client/ply-boot-client.c b/src/client/ply-boot-client.c index 08eb6b9..c349837 100644 --- a/src/client/ply-boot-client.c +++ b/src/client/ply-boot-client.c @@ -468,6 +468,18 @@ ply_boot_client_ask_daemon_for_password (ply_boot_client_t *cli } void +ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t *client, + ply_boot_client_response_handler_t handler, + ply_boot_client_response_handler_t failed_handler, + void *user_data) +{ + assert (client != NULL); + + ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH, + NULL, handler, failed_handler, user_data); +} + +void ply_boot_client_tell_daemon_to_quit (ply_boot_client_t *client, ply_boot_client_response_handler_t handler, ply_boot_client_response_handler_t failed_handler, diff --git a/src/client/ply-boot-client.h b/src/client/ply-boot-client.h index 4c72db2..c3240cd 100644 --- a/src/client/ply-boot-client.h +++ b/src/client/ply-boot-client.h @@ -40,7 +40,7 @@ typedef void (* ply_boot_client_disconnect_handler_t) (void *user_d #ifndef PLY_HIDE_FUNCTION_DECLARATIONS ply_boot_client_t *ply_boot_client_new (void); - + void ply_boot_client_free (ply_boot_client_t *client); bool ply_boot_client_connect (ply_boot_client_t *client, ply_boot_client_disconnect_handler_t disconnect_handler, @@ -62,6 +62,10 @@ void ply_boot_client_tell_daemon_system_is_initialized (ply_boot_client_t ply_boot_client_response_handler_t handler, ply_boot_client_response_handler_t failed_handler, void *user_data); +void ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t *client, + ply_boot_client_response_handler_t handler, + ply_boot_client_response_handler_t failed_handler, + void *user_data); void ply_boot_client_tell_daemon_to_quit (ply_boot_client_t *client, ply_boot_client_response_handler_t handler, ply_boot_client_response_handler_t failed_handler, diff --git a/src/client/plymouth.c b/src/client/plymouth.c index 048563d..df503fc 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -59,7 +59,7 @@ on_disconnect (ply_event_loop_t *loop) void print_usage (void) { - ply_log ("rhgb-client [--ping] [--update=STATUS] [--details] [--sysinit] [--quit]"); + ply_log ("rhgb-client [--ping] [--update=STATUS] [--show-splash] [--details] [--sysinit] [--quit]"); ply_flush_log (); } @@ -69,7 +69,7 @@ main (int argc, { ply_event_loop_t *loop; ply_boot_client_t *client; - bool should_quit, should_ping, should_update, should_sysinit, should_ask_for_password; + bool should_quit, should_ping, should_update, should_sysinit, should_ask_for_password, should_show_splash; char *status; int exit_code; int i; @@ -89,6 +89,7 @@ main (int argc, should_update = false; should_quit = false; should_ask_for_password = false; + should_show_splash = false; status = NULL; for (i = 1; i < argc; i++) { @@ -103,6 +104,8 @@ main (int argc, should_ping = true; else if (strstr (argv[i], "--sysinit") != NULL) should_sysinit = true; + else if (strstr (argv[i], "--show-splash") != NULL) + should_show_splash = true; else if (strstr (argv[i], "--ask-for-password") != NULL) should_ask_for_password = true; else if (strstr (argv[i], "--update") != NULL) @@ -142,7 +145,13 @@ main (int argc, ply_boot_client_attach_to_event_loop (client, loop); - if (should_quit) + if (should_show_splash) + ply_boot_client_tell_daemon_to_show_splash (client, + (ply_boot_client_response_handler_t) + on_success, + (ply_boot_client_response_handler_t) + on_failure, loop); + else if (should_quit) ply_boot_client_tell_daemon_to_quit (client, (ply_boot_client_response_handler_t) on_success, @@ -94,8 +94,9 @@ on_update (state_t *state, const char *status) { ply_trace ("updating status to '%s'", status); - ply_boot_splash_update_status (state->boot_splash, - status); + if (state->boot_splash != NULL) + ply_boot_splash_update_status (state->boot_splash, + status); } static char * @@ -116,12 +117,32 @@ on_system_initialized (state_t *state) } static void +on_show_splash (state_t *state) +{ + ply_trace ("Showing splash screen"); + state->boot_splash = start_boot_splash (state, + PLYMOUTH_PLUGIN_PATH "fedora-fade-in.so"); + + if (state->boot_splash == NULL) + { + ply_trace ("Could not start graphical splash screen," + "showing text splash screen"); + state->boot_splash = start_boot_splash (state, + PLYMOUTH_PLUGIN_PATH "text.so"); + } + + if (state->boot_splash == NULL) + ply_error ("could not start boot splash: %m"); +} + +static void on_quit (state_t *state) { ply_trace ("time to quit, closing log"); ply_terminal_session_close_log (state->session); ply_trace ("hiding splash"); - ply_boot_splash_hide (state->boot_splash); + if (state->boot_splash != NULL) + ply_boot_splash_hide (state->boot_splash); ply_trace ("exiting event loop"); ply_event_loop_exit (state->loop, 0); @@ -142,6 +163,7 @@ start_boot_server (state_t *state) server = ply_boot_server_new ((ply_boot_server_update_handler_t) on_update, (ply_boot_server_ask_for_password_handler_t) on_ask_for_password, + (ply_boot_server_show_splash_handler_t) on_show_splash, (ply_boot_server_system_initialized_handler_t) on_system_initialized, (ply_boot_server_quit_handler_t) on_quit, state); @@ -447,7 +469,7 @@ int main (int argc, char **argv) { - state_t state; + state_t state = { 0 }; int exit_code; if (argc <= 1) @@ -492,21 +514,6 @@ main (int argc, state.window = create_window (&state, "/dev/tty1"); - state.boot_splash = start_boot_splash (&state, - PLYMOUTH_PLUGIN_PATH "fedora-fade-in.so"); - - if (state.boot_splash == NULL) - { - state.boot_splash = start_boot_splash (&state, - PLYMOUTH_PLUGIN_PATH "text.so"); - } - - if (state.boot_splash == NULL) - { - ply_error ("could not start boot splash: %m"); - return EX_UNAVAILABLE; - } - ply_trace ("entering event loop"); exit_code = ply_event_loop_run (state.loop); ply_trace ("exited event loop"); diff --git a/src/ply-boot-protocol.h b/src/ply-boot-protocol.h index bdaf4c5..5dc0877 100644 --- a/src/ply-boot-protocol.h +++ b/src/ply-boot-protocol.h @@ -28,6 +28,7 @@ #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_SYSTEM_INITIALIZED "S" #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT "Q" #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD "*" +#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH "$" #define PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK "\x6" #define PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER "\x2" diff --git a/src/ply-boot-server.c b/src/ply-boot-server.c index 5d3ecc9..d34d04a 100644 --- a/src/ply-boot-server.c +++ b/src/ply-boot-server.c @@ -51,6 +51,7 @@ struct _ply_boot_server ply_boot_server_update_handler_t update_handler; ply_boot_server_system_initialized_handler_t system_initialized_handler; + ply_boot_server_show_splash_handler_t show_splash_handler; ply_boot_server_ask_for_password_handler_t ask_for_password_handler; ply_boot_server_quit_handler_t quit_handler; void *user_data; @@ -61,6 +62,7 @@ struct _ply_boot_server ply_boot_server_t * ply_boot_server_new (ply_boot_server_update_handler_t update_handler, ply_boot_server_ask_for_password_handler_t ask_for_password_handler, + ply_boot_server_show_splash_handler_t show_splash_handler, ply_boot_server_system_initialized_handler_t initialized_handler, ply_boot_server_quit_handler_t quit_handler, void *user_data) @@ -74,6 +76,7 @@ ply_boot_server_new (ply_boot_server_update_handler_t update_handler, server->update_handler = update_handler; server->ask_for_password_handler = ask_for_password_handler; server->system_initialized_handler = initialized_handler; + server->show_splash_handler = show_splash_handler; server->quit_handler = quit_handler; server->user_data = user_data; @@ -192,6 +195,12 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) if (server->system_initialized_handler != NULL) server->system_initialized_handler (server->user_data, server); } + else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH) == 0) + { + ply_trace ("got show splash request"); + if (server->show_splash_handler != NULL) + server->show_splash_handler (server->user_data, server); + } else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT) == 0) { if (server->quit_handler != NULL) @@ -343,6 +352,12 @@ on_system_initialized (ply_event_loop_t *loop) } static void +on_show_splash (ply_event_loop_t *loop) +{ + printf ("got show splash request\n"); +} + +static void on_quit (ply_event_loop_t *loop) { printf ("got quit request, quiting...\n"); @@ -371,6 +386,7 @@ main (int argc, server = ply_boot_server_new ((ply_boot_server_update_handler_t) on_update, (ply_boot_server_ask_for_password_handler_t) on_ask_for_password, + (ply_boot_server_show_splash_handler_t) on_show_splash, (ply_boot_server_system_initialized_handler_t) on_system_initialized, (ply_boot_server_quit_handler_t) on_quit, loop); diff --git a/src/ply-boot-server.h b/src/ply-boot-server.h index f809af0..7ddab15 100644 --- a/src/ply-boot-server.h +++ b/src/ply-boot-server.h @@ -35,6 +35,9 @@ typedef void (* ply_boot_server_update_handler_t) (void *user_data, const char *status, ply_boot_server_t *server); +typedef void (* ply_boot_server_show_splash_handler_t) (void *user_data, + ply_boot_server_t *server); + typedef char * (* ply_boot_server_ask_for_password_handler_t) (void *user_data, ply_boot_server_t *server); @@ -47,6 +50,7 @@ typedef void (* ply_boot_server_quit_handler_t) (void *user_data, #ifndef PLY_HIDE_FUNCTION_DECLARATIONS ply_boot_server_t *ply_boot_server_new (ply_boot_server_update_handler_t update_handler, ply_boot_server_ask_for_password_handler_t ask_for_password_handler, + ply_boot_server_show_splash_handler_t show_splash_handler, ply_boot_server_system_initialized_handler_t initialized_handler, ply_boot_server_quit_handler_t quit_handler, void *user_data); |