]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
New nolog option to disable console redirection
authorRay Strode <rstrode@redhat.com>
Tue, 7 Oct 2008 14:24:46 +0000 (10:24 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 8 Oct 2008 17:55:30 +0000 (13:55 -0400)
It seems like there may be cases where it's better
to not do the whole TIOCCONS song and dance.  This
provides an escape hatch.

src/libply/ply-terminal-session.c
src/main.c

index 24e532b0ab43516923f36a60ca5b3181430997c5..f7c911bdab8a0bc673771a474ef398592d537346 100644 (file)
@@ -236,6 +236,7 @@ ply_terminal_session_run (ply_terminal_session_t              *session,
   look_in_path = (flags & PLY_TERMINAL_SESSION_FLAGS_LOOK_IN_PATH) != 0;
   should_redirect_console = 
     (flags & PLY_TERMINAL_SESSION_FLAGS_REDIRECT_CONSOLE) != 0;
+  should_redirect_console = 0;
 
   ply_trace ("creating terminal device");
   if (!ply_terminal_create_device (session->terminal))
index 2680b8379880092b1ddd5b526e3c7823d41d9e44..2f7a5315cfb220e5cf121f2b52b9b8b5ff443d2c 100644 (file)
@@ -58,6 +58,7 @@ typedef struct
   long ptmx;
 
   char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE];
+  uint32_t no_boot_log : 1;
   uint32_t showing_details : 1;
   uint32_t system_initialized : 1;
 
@@ -520,7 +521,9 @@ attach_to_running_session (state_t *state)
   ply_terminal_session_flags_t flags;
 
   flags = 0;
-  flags |= PLY_TERMINAL_SESSION_FLAGS_REDIRECT_CONSOLE;
+
+  if (!state->no_boot_log)
+    flags |= PLY_TERMINAL_SESSION_FLAGS_REDIRECT_CONSOLE;
 
   ply_trace ("creating terminal session for current terminal");
   session = ply_terminal_session_new (NULL);
@@ -531,7 +534,7 @@ attach_to_running_session (state_t *state)
                                  (ply_terminal_session_output_handler_t)
                                  on_session_output,
                                  (ply_terminal_session_done_handler_t)
-                                 on_session_finished,
+                                 (state->no_boot_log? NULL: on_session_finished),
                                  state->ptmx,
                                  state))
     {
@@ -588,6 +591,22 @@ check_verbosity (state_t *state)
     ply_trace ("tracing shouldn't be enabled!");
 }
 
+static void
+check_logging (state_t *state)
+{
+  ply_trace ("checking if console messages should be redirected and logged");
+
+  if ((strstr (state->kernel_command_line, " plymouth:nolog ") != NULL)
+     || (strstr (state->kernel_command_line, "plymouth:nolog ") != NULL)
+     || (strstr (state->kernel_command_line, " plymouth:nolog") != NULL))
+    {
+      ply_trace ("logging should be enabled!");
+      state->no_boot_log = true;
+    }
+  else
+    ply_trace ("logging shouldn't be enabled!");
+}
+
 static void
 check_for_consoles (state_t *state)
 {
@@ -658,6 +677,7 @@ initialize_environment (state_t *state)
     return false;
 
   check_verbosity (state);
+  check_logging (state);
 
   state->windows = ply_list_new ();
   check_for_consoles (state);