]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
systemd: toggle systemd messages when toggling console redirection
authorRay Strode <rstrode@redhat.com>
Tue, 29 Mar 2011 02:14:34 +0000 (22:14 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 29 Mar 2011 02:45:48 +0000 (22:45 -0400)
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.

configure.ac
src/main.c

index da9e03db7a8fb91126c35d2a6624ca7d600aeb40..205607eb71a6c729304cc806e1db0e50a5e25933 100644 (file)
@@ -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])
 
index f6cec9e4a0e5a0d214abeda9d50769662ab527b2..fe87e15a59ceae2cbd5770e35a705284a0065ad9 100644 (file)
@@ -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;