Send plymouth mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.freedesktop.org/mailman/listinfo/plymouth
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of plymouth digest..."
Today's Topics:
1. [PATCH 6/9] add no-daemon command line option
([email protected])
2. [PATCH 8/9] add debug command line option
([email protected])
3. [PATCH 7/9] add a message display method
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Mon, 23 Feb 2009 15:35:54 -0500
From: [email protected]
Subject: [PATCH 6/9] add no-daemon command line option
To: [email protected]
Cc: William Jon McCann <[email protected]>
Message-ID:
<[email protected]>
From: William Jon McCann <[email protected]>
Useful for debugging and running under gdb
---
src/main.c | 39 +++++++++++++++++++++++++--------------
1 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/src/main.c b/src/main.c
index fe4df58..44ac147 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1144,6 +1144,7 @@ main (int argc,
};
int exit_code;
bool should_help = false;
+ bool no_daemon = false;
ply_daemon_handle_t *daemon_handle;
char *mode_string = NULL;
@@ -1153,6 +1154,7 @@ main (int argc,
ply_command_parser_add_options (state.command_parser,
"help", "This help message",
PLY_COMMAND_OPTION_TYPE_FLAG,
+ "no-daemon", "Do not daemonize",
PLY_COMMAND_OPTION_TYPE_FLAG,
"mode", "Mode is one of: boot, shutdown",
PLY_COMMAND_OPTION_TYPE_STRING,
"attach-to-session", "pty_master_fd",
PLY_COMMAND_OPTION_TYPE_LONG,
NULL);
@@ -1172,6 +1174,7 @@ main (int argc,
ply_command_parser_get_options (state.command_parser,
"help", &should_help,
"mode", &mode_string,
+ "no-daemon", &no_daemon,
"attach-to-session", &state.ptmx,
NULL);
if (should_help)
@@ -1208,12 +1211,15 @@ main (int argc,
chdir ("/");
signal (SIGPIPE, SIG_IGN);
- daemon_handle = ply_create_daemon ();
-
- if (daemon_handle == NULL)
+ if (! no_daemon)
{
- ply_error ("cannot daemonize: %m");
- return EX_UNAVAILABLE;
+ daemon_handle = ply_create_daemon ();
+
+ if (daemon_handle == NULL)
+ {
+ ply_error ("cannot daemonize: %m");
+ return EX_UNAVAILABLE;
+ }
}
signal (SIGABRT, on_crash);
@@ -1226,12 +1232,14 @@ main (int argc,
{
if (errno == 0)
{
- ply_detach_daemon (daemon_handle, 0);
+ if (! no_daemon)
+ ply_detach_daemon (daemon_handle, 0);
return 0;
}
ply_error ("could not setup basic operating environment: %m");
- ply_detach_daemon (daemon_handle, EX_OSERR);
+ if (! no_daemon)
+ ply_detach_daemon (daemon_handle, EX_OSERR);
return EX_OSERR;
}
@@ -1242,7 +1250,8 @@ main (int argc,
if (!attach_to_running_session (&state))
{
ply_error ("could not create session: %m");
- ply_detach_daemon (daemon_handle, EX_UNAVAILABLE);
+ if (! no_daemon)
+ ply_detach_daemon (daemon_handle, EX_UNAVAILABLE);
return EX_UNAVAILABLE;
}
}
@@ -1252,15 +1261,17 @@ main (int argc,
if (state.boot_server == NULL)
{
ply_error ("could not log bootup: %m");
- ply_detach_daemon (daemon_handle, EX_UNAVAILABLE);
+ if (! no_daemon)
+ ply_detach_daemon (daemon_handle, EX_UNAVAILABLE);
return EX_UNAVAILABLE;
}
- if (!ply_detach_daemon (daemon_handle, 0))
- {
- ply_error ("could not tell parent to exit: %m");
- return EX_UNAVAILABLE;
- }
+ if (! no_daemon)
+ if (!ply_detach_daemon (daemon_handle, 0))
+ {
+ ply_error ("could not tell parent to exit: %m");
+ return EX_UNAVAILABLE;
+ }
state.progress = ply_progress_new ();
--
1.6.1.3
------------------------------
Message: 2
Date: Mon, 23 Feb 2009 15:35:56 -0500
From: [email protected]
Subject: [PATCH 8/9] add debug command line option
To: [email protected]
Cc: William Jon McCann <[email protected]>
Message-ID:
<[email protected]>
From: William Jon McCann <[email protected]>
Used to override the kernel command line and enabled debugging
---
src/main.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 62085b2..ce482ad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1103,8 +1103,7 @@ initialize_environment (state_t *state)
redirect_standard_io_to_device (state->console);
else
redirect_standard_io_to_device ("tty1");
-
-
+
for (node = ply_list_get_first_node (state->windows); node;
node = ply_list_get_next_node (state->windows, node))
{
@@ -1154,6 +1153,7 @@ main (int argc,
int exit_code;
bool should_help = false;
bool no_daemon = false;
+ bool debug = false;
ply_daemon_handle_t *daemon_handle;
char *mode_string = NULL;
@@ -1164,6 +1164,7 @@ main (int argc,
ply_command_parser_add_options (state.command_parser,
"help", "This help message",
PLY_COMMAND_OPTION_TYPE_FLAG,
"no-daemon", "Do not daemonize",
PLY_COMMAND_OPTION_TYPE_FLAG,
+ "debug", "Output debugging information",
PLY_COMMAND_OPTION_TYPE_FLAG,
"mode", "Mode is one of: boot, shutdown",
PLY_COMMAND_OPTION_TYPE_STRING,
"attach-to-session", "pty_master_fd",
PLY_COMMAND_OPTION_TYPE_LONG,
NULL);
@@ -1184,6 +1185,7 @@ main (int argc,
"help", &should_help,
"mode", &mode_string,
"no-daemon", &no_daemon,
+ "debug", &debug,
"attach-to-session", &state.ptmx,
NULL);
if (should_help)
@@ -1201,6 +1203,9 @@ main (int argc,
return 0;
}
+ if (debug)
+ ply_toggle_tracing ();
+
if (mode_string != NULL)
{
if (strcmp (mode_string, "shutdown") == 0)
--
1.6.1.3
------------------------------
Message: 3
Date: Mon, 23 Feb 2009 15:35:55 -0500
From: [email protected]
Subject: [PATCH 7/9] add a message display method
To: [email protected]
Cc: William Jon McCann <[email protected]>
Message-ID:
<[email protected]>
From: William Jon McCann <[email protected]>
Useful for showing messages like "Shutting down..." etc. A plugin
may choose not to support this feature.
---
src/client/ply-boot-client.c | 14 ++++++++
src/client/ply-boot-client.h | 5 +++
src/client/plymouth.c | 10 +++++-
src/libplybootsplash/ply-boot-splash-plugin.h | 2 +
src/main.c | 10 ++++++
src/plugins/splash/text/plugin.c | 42 +++++++++++++++++++++++++
src/ply-boot-protocol.h | 1 +
src/ply-boot-server.c | 16 +++++++++
src/ply-boot-server.h | 4 ++
src/ply-boot-splash.c | 9 +++++
src/ply-boot-splash.h | 2 +
11 files changed, 114 insertions(+), 1 deletions(-)
diff --git a/src/client/ply-boot-client.c b/src/client/ply-boot-client.c
index 7354d3a..ca96bcd 100644
--- a/src/client/ply-boot-client.c
+++ b/src/client/ply-boot-client.c
@@ -530,6 +530,20 @@ ply_boot_client_tell_daemon_to_change_root
(ply_boot_client_t *
}
void
+ply_boot_client_tell_daemon_to_display_message (ply_boot_client_t
*client,
+ const char
*message,
+
ply_boot_client_response_handler_t handler,
+
ply_boot_client_response_handler_t failed_handler,
+ void
*user_data)
+{
+ assert (client != NULL);
+ assert (message != NULL);
+
+ ply_boot_client_queue_request (client,
PLY_BOOT_PROTOCOL_REQUEST_TYPE_MESSAGE,
+ message, handler, failed_handler, user_data);
+}
+
+void
ply_boot_client_tell_daemon_system_is_initialized (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 cca9feb..43684ac 100644
--- a/src/client/ply-boot-client.h
+++ b/src/client/ply-boot-client.h
@@ -63,6 +63,11 @@ void ply_boot_client_tell_daemon_to_change_root
(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_display_message (ply_boot_client_t
*client,
+ const char
*message,
+
ply_boot_client_response_handler_t handler,
+
ply_boot_client_response_handler_t failed_handler,
+ void
*user_data);
void ply_boot_client_ask_daemon_for_password (ply_boot_client_t
*client,
const char
*prompt,
ply_boot_client_answer_handler_t
handler,
diff --git a/src/client/plymouth.c b/src/client/plymouth.c
index 60e86fb..fd8f948 100644
--- a/src/client/plymouth.c
+++ b/src/client/plymouth.c
@@ -596,7 +596,7 @@ main (int argc,
{
state_t state = { 0 };
bool should_help, should_quit, should_ping, should_sysinit,
should_ask_for_password, should_show_splash, should_hide_splash, should_wait,
should_be_verbose, report_error;
- char *status, *chroot_dir, *ignore_keystroke;
+ char *status, *chroot_dir, *ignore_keystroke, *message;
int exit_code;
exit_code = 0;
@@ -619,6 +619,7 @@ main (int argc,
"ask-for-password", "Ask user for password",
PLY_COMMAND_OPTION_TYPE_FLAG,
"ignore-keystroke", "Remove sensitivity to a
keystroke", PLY_COMMAND_OPTION_TYPE_STRING,
"update", "Tell boot daemon an update about
boot progress", PLY_COMMAND_OPTION_TYPE_STRING,
+ "message", "Tell boot daemon to display a
message", PLY_COMMAND_OPTION_TYPE_STRING,
"details", "Tell boot daemon there were
errors during boot", PLY_COMMAND_OPTION_TYPE_FLAG,
"wait", "Wait for boot daemon to quit",
PLY_COMMAND_OPTION_TYPE_FLAG,
NULL);
@@ -706,6 +707,7 @@ main (int argc,
"sysinit", &should_sysinit,
"show-splash", &should_show_splash,
"hide-splash", &should_hide_splash,
+ "message", &message,
"ask-for-password", &should_ask_for_password,
"ignore-keystroke", &ignore_keystroke,
"update", &status,
@@ -784,6 +786,12 @@ main (int argc,
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
+ else if (message != NULL)
+ ply_boot_client_tell_daemon_to_display_message (state.client, message,
+
(ply_boot_client_response_handler_t)
+ on_success,
+
(ply_boot_client_response_handler_t)
+ on_failure, &state);
else if (should_ask_for_password)
{
password_answer_state_t answer_state = { 0 };
diff --git a/src/libplybootsplash/ply-boot-splash-plugin.h
b/src/libplybootsplash/ply-boot-splash-plugin.h
index 9361955..5eca3b3 100644
--- a/src/libplybootsplash/ply-boot-splash-plugin.h
+++ b/src/libplybootsplash/ply-boot-splash-plugin.h
@@ -58,6 +58,8 @@ typedef struct
void (* hide_splash_screen) (ply_boot_splash_plugin_t *plugin,
ply_event_loop_t *loop);
void (* display_normal) (ply_boot_splash_plugin_t *plugin);
+ void (* display_message) (ply_boot_splash_plugin_t *plugin,
+ const char *message);
void (* display_password) (ply_boot_splash_plugin_t *plugin,
const char *prompt,
int bullets);
diff --git a/src/main.c b/src/main.c
index 44ac147..62085b2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -203,6 +203,14 @@ on_ask_question (state_t *state,
}
static void
+on_display_message (state_t *state,
+ const char *message)
+{
+ if (state->boot_splash != NULL)
+ ply_boot_splash_display_message (state->boot_splash, message);
+}
+
+static void
on_watch_for_keystroke (state_t *state,
const char *keys,
ply_trigger_t *trigger)
@@ -639,6 +647,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_ask_question_handler_t)
on_ask_question,
+ (ply_boot_server_display_message_handler_t)
on_display_message,
(ply_boot_server_watch_for_keystroke_handler_t) on_watch_for_keystroke,
(ply_boot_server_ignore_keystroke_handler_t)
on_ignore_keystroke,
(ply_boot_server_progress_pause_handler_t)
on_progress_pause,
@@ -1288,6 +1297,7 @@ main (int argc,
ply_boot_splash_free (state.boot_splash);
state.boot_splash = NULL;
+ ply_command_parser_free (state.command_parser);
ply_list_free (state.windows);
ply_boot_server_free (state.boot_server);
diff --git a/src/plugins/splash/text/plugin.c b/src/plugins/splash/text/plugin.c
index 6a5b4b0..c8dc051 100644
--- a/src/plugins/splash/text/plugin.c
+++ b/src/plugins/splash/text/plugin.c
@@ -67,6 +67,8 @@ struct _ply_boot_splash_plugin
ply_text_progress_bar_t *progress_bar;
+ char *message;
+
uint32_t is_animating : 1;
};
void hide_splash_screen (ply_boot_splash_plugin_t *plugin,
@@ -81,6 +83,7 @@ create_plugin (void)
plugin = calloc (1, sizeof (ply_boot_splash_plugin_t));
plugin->progress_bar = ply_text_progress_bar_new ();
+ plugin->message = NULL;
return plugin;
}
@@ -107,17 +110,45 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
hide_splash_screen (plugin, plugin->loop);
ply_text_progress_bar_free (plugin->progress_bar);
+ if (plugin->message != NULL)
+ free (plugin->message);
free (plugin);
}
static void
+show_message (ply_boot_splash_plugin_t *plugin)
+{
+ int window_width, window_height;
+ int i;
+
+ window_width = ply_window_get_number_of_text_columns (plugin->window);
+ window_height = ply_window_get_number_of_text_rows (plugin->window);
+
+ ply_window_set_text_cursor_position (plugin->window,
+ 0, window_height / 2);
+
+ for (i=0; i < window_width; i++)
+ {
+ write (STDOUT_FILENO, " ", strlen (" "));
+ }
+ ply_window_set_text_cursor_position (plugin->window,
+ (window_width - strlen
(plugin->message)) / 2,
+ window_height / 2);
+
+ write (STDOUT_FILENO, plugin->message, strlen (plugin->message));
+}
+
+static void
start_animation (ply_boot_splash_plugin_t *plugin)
{
assert (plugin != NULL);
assert (plugin->loop != NULL);
+ if (plugin->message != NULL)
+ show_message (plugin);
+
if (plugin->is_animating)
return;
@@ -324,6 +355,16 @@ void display_normal (ply_boot_splash_plugin_t *plugin)
start_animation(plugin);
}
+void display_message (ply_boot_splash_plugin_t *plugin,
+ const char *message)
+{
+ if (plugin->message != NULL)
+ free (plugin->message);
+
+ plugin->message = strdup (message);
+ start_animation (plugin);
+}
+
void
display_password (ply_boot_splash_plugin_t *plugin,
const char *prompt,
@@ -409,6 +450,7 @@ ply_boot_splash_plugin_get_interface (void)
.on_boot_progress = on_boot_progress,
.hide_splash_screen = hide_splash_screen,
.display_normal = display_normal,
+ .display_message = display_message,
.display_password = display_password,
.display_question = display_question,
};
diff --git a/src/ply-boot-protocol.h b/src/ply-boot-protocol.h
index 5b2d102..419d481 100644
--- a/src/ply-boot-protocol.h
+++ b/src/ply-boot-protocol.h
@@ -30,6 +30,7 @@
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD "*"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD "c"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUESTION "W"
+#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_MESSAGE "M"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE "K"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE_REMOVE "L"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PROGRESS_PAUSE "A"
diff --git a/src/ply-boot-server.c b/src/ply-boot-server.c
index 8615f3b..23ae822 100644
--- a/src/ply-boot-server.c
+++ b/src/ply-boot-server.c
@@ -60,6 +60,7 @@ struct _ply_boot_server
ply_boot_server_hide_splash_handler_t hide_splash_handler;
ply_boot_server_ask_for_password_handler_t ask_for_password_handler;
ply_boot_server_ask_question_handler_t ask_question_handler;
+ ply_boot_server_display_message_handler_t display_message_handler;
ply_boot_server_watch_for_keystroke_handler_t watch_for_keystroke_handler;
ply_boot_server_ignore_keystroke_handler_t ignore_keystroke_handler;
ply_boot_server_progress_pause_handler_t progress_pause_handler;
@@ -74,6 +75,7 @@ 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_ask_question_handler_t
ask_question_handler,
+ ply_boot_server_display_message_handler_t
display_message_handler,
ply_boot_server_watch_for_keystroke_handler_t
watch_for_keystroke_handler,
ply_boot_server_ignore_keystroke_handler_t
ignore_keystroke_handler,
ply_boot_server_progress_pause_handler_t
progress_pause_handler,
@@ -96,6 +98,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->ask_question_handler = ask_question_handler;
+ server->display_message_handler = display_message_handler;
server->watch_for_keystroke_handler = watch_for_keystroke_handler;
server->ignore_keystroke_handler = ignore_keystroke_handler;
server->progress_pause_handler = progress_pause_handler;
@@ -444,6 +447,11 @@ ply_boot_connection_on_request (ply_boot_connection_t
*connection)
free(command);
return;
}
+ else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_MESSAGE) == 0)
+ {
+ if (server->display_message_handler != NULL)
+ server->display_message_handler(server->user_data, argument, server);
+ }
else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE) == 0)
{
ply_trigger_t *answer;
@@ -659,6 +667,13 @@ on_ask_question (ply_event_loop_t *loop)
}
static void
+on_display_message (ply_event_loop_t *loop)
+{
+ printf ("got display message request\n");
+ return;
+}
+
+static void
on_watch_for_keystroke (ply_event_loop_t *loop)
{
printf ("got keystroke request\n");
@@ -705,6 +720,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_ask_question_handler_t)
on_ask_question,
+ (ply_boot_server_display_message_handler_t)
on_display_message,
(ply_boot_server_watch_for_keystroke_handler_t) on_watch_for_keystroke,
(ply_boot_server_ignore_keystroke_handler_t)
on_ignore_keystroke,
(ply_boot_server_progress_pause_handler_t)
on_progress_pause,
diff --git a/src/ply-boot-server.h b/src/ply-boot-server.h
index 0817ea6..99ee2a5 100644
--- a/src/ply-boot-server.h
+++ b/src/ply-boot-server.h
@@ -60,6 +60,9 @@ typedef void (* ply_boot_server_ask_question_handler_t)
(void
const char
*prompt,
ply_trigger_t
*answer,
ply_boot_server_t *server);
+typedef void (* ply_boot_server_display_message_handler_t) (void
*user_data,
+ const char
*message,
+
ply_boot_server_t *server);
typedef void (* ply_boot_server_watch_for_keystroke_handler_t) (void
*user_data,
const char
*keys,
ply_trigger_t
*answer,
@@ -85,6 +88,7 @@ typedef void (* ply_boot_server_quit_handler_t) (void
*user_data,
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_ask_question_handler_t
ask_question_handler,
+
ply_boot_server_display_message_handler_t display_message_handler,
ply_boot_server_watch_for_keystroke_handler_t watch_for_keystroke_handler,
ply_boot_server_ignore_keystroke_handler_t ignore_keystroke_handler,
ply_boot_server_progress_pause_handler_t on_progress_pause,
diff --git a/src/ply-boot-splash.c b/src/ply-boot-splash.c
index b67ad20..a8697d8 100644
--- a/src/ply-boot-splash.c
+++ b/src/ply-boot-splash.c
@@ -326,6 +326,15 @@ void ply_boot_splash_display_normal (ply_boot_splash_t
*splash)
if (splash->plugin_interface->display_normal != NULL)
splash->plugin_interface->display_normal (splash->plugin);
}
+void ply_boot_splash_display_message (ply_boot_splash_t *splash,
+ const char *message)
+{
+ assert (splash != NULL);
+ assert (splash->plugin_interface != NULL);
+ assert (splash->plugin != NULL);
+ if (splash->plugin_interface->display_message != NULL)
+ splash->plugin_interface->display_message (splash->plugin, message);
+}
void ply_boot_splash_display_password (ply_boot_splash_t *splash,
const char *prompt,
int bullets)
diff --git a/src/ply-boot-splash.h b/src/ply-boot-splash.h
index f925694..4326357 100644
--- a/src/ply-boot-splash.h
+++ b/src/ply-boot-splash.h
@@ -55,6 +55,8 @@ void ply_boot_splash_update_output (ply_boot_splash_t *splash,
void ply_boot_splash_root_mounted (ply_boot_splash_t *splash);
void ply_boot_splash_hide (ply_boot_splash_t *splash);
void ply_boot_splash_display_normal (ply_boot_splash_t *splash);
+void ply_boot_splash_display_message (ply_boot_splash_t *splash,
+ const char *message);
void ply_boot_splash_display_password (ply_boot_splash_t *splash,
const char *prompt,
int bullets);
--
1.6.1.3
------------------------------
_______________________________________________
plymouth mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/plymouth
End of plymouth Digest, Vol 5, Issue 2
**************************************