summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2011-03-28 22:14:34 -0400
committerRay Strode <rstrode@redhat.com>2011-03-28 22:45:48 -0400
commit537c16422cd49f1beeaab1ad39846a00018faec1 (patch)
treeabf0ca57358970bd5c8c9d24414c50032a63e97f
parent7f3871b0f5c7c90057c66bd38ad63043a61f40e6 (diff)
systemd: toggle systemd messages when toggling console redirection
Normally systemd is very mute about messages. It's important, though for it to be chatty when plymouth is running so we can show verbose messages to the user when they hit escape. This commit adds a new --enable-systemd-integration configure flag which explicitly tells systemd when to print messages to the console. This may get dropped in the future in lieu of init script changes doing this instead of plymouth directly.
-rw-r--r--configure.ac7
-rw-r--r--src/main.c26
2 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index da9e03db..205607eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -242,6 +242,13 @@ if test x$enable_upstart_monitoring = xyes; then
fi
AM_CONDITIONAL(ENABLE_UPSTART_MONITORING, [test "$enable_upstart_monitoring" = yes])
+AC_ARG_ENABLE(systemd-integration, AS_HELP_STRING([--enable-systemd-integration],[coordinate boot up with systemd]),enable_systemd_integration=$enableval,enable_systemd_integration=no)
+AM_CONDITIONAL(ENABLE_SYSTEMD_INTEGRATION, [test "$enable_systemd_integration" = yes])
+
+if text x$enable_systemd_integration = xyes; then
+ AC_DEFINE(PLY_ENABLE_SYSTEMD_INTEGRATION, 1, [Coordinate boot up with systemd])
+fi
+
AC_ARG_WITH(system-root-install, AS_HELP_STRING([--with-system-root-install],[Install client in /bin and daemon in /sbin]),with_system_root_install=${withval},with_system_root_install=yes)
AM_CONDITIONAL(WITH_SYSTEM_ROOT_INSTALL, [test "$with_system_root_install" = yes])
diff --git a/src/main.c b/src/main.c
index f6cec9e4..fe87e15a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1501,6 +1501,24 @@ add_displays_and_keyboard_to_boot_splash (state_t *state,
}
}
+#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
+static void
+tell_systemd_to_print_details (state_t *state)
+{
+ ply_trace ("telling systemd to start printing details");
+ if (kill (1, SIGRTMIN + 20) < 0)
+ ply_trace ("could not tell systemd to print details: %m");
+}
+
+static void
+tell_systemd_to_stop_printing_details (state_t *state)
+{
+ ply_trace ("telling systemd to stop printing details");
+ if (kill (1, SIGRTMIN + 21) < 0)
+ ply_trace ("could not tell systemd to stop printing details: %m");
+}
+#endif
+
static ply_boot_splash_t *
start_boot_splash (state_t *state,
const char *theme_path,
@@ -1614,6 +1632,10 @@ attach_to_running_session (state_t *state)
state->is_attached = true;
state->session = session;
+#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
+ tell_systemd_to_print_details (state);
+#endif
+
return true;
}
@@ -1626,6 +1648,10 @@ detach_from_running_session (state_t *state)
if (!state->is_attached)
return;
+#ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
+ tell_systemd_to_stop_printing_details (state);
+#endif
+
ply_trace ("detaching from terminal session");
ply_terminal_session_detach (state->session);
state->is_redirected = false;