From cc757aa3b80127ddde66d172bcf8ec96474c2220 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 27 Mar 2014 12:54:45 -0700 Subject: [PATCH 2/2] main: add a --no-boot-log commandline option For systems that want to keep disk writes at the very minimum. https://bugs.freedesktop.org/show_bug.cgi?id=76706 --- src/main.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main.c b/src/main.c index a2cc714..17c09cb 100644 --- a/src/main.c +++ b/src/main.c @@ -1941,18 +1941,18 @@ check_verbosity (state_t *state) static void check_logging (state_t *state) { + bool kernel_no_log; + ply_trace ("checking if console messages should be redirected and logged"); - if (command_line_has_argument (state->kernel_command_line, "plymouth.nolog")) - { - ply_trace ("logging won't be enabled!"); - state->no_boot_log = true; - } + kernel_no_log = command_line_has_argument (state->kernel_command_line, "plymouth.nolog"); + if (kernel_no_log) + state->no_boot_log = true; + + if (state->no_boot_log) + ply_trace ("logging won't be enabled!"); else - { - ply_trace ("logging will be enabled!"); - state->no_boot_log = false; - } + ply_trace ("logging will be enabled!"); } static bool @@ -2139,6 +2139,7 @@ main (int argc, state_t state = { 0 }; int exit_code; bool should_help = false; + bool no_boot_log = false; bool no_daemon = false; bool debug = false; bool attach_to_session; @@ -2163,6 +2164,7 @@ main (int argc, "pid-file", "Write the pid of the daemon to a file", PLY_COMMAND_OPTION_TYPE_STRING, "kernel-command-line", "Fake kernel command line to use", PLY_COMMAND_OPTION_TYPE_STRING, "tty", "TTY to use instead of default", PLY_COMMAND_OPTION_TYPE_STRING, + "no-boot-log", "Do not write boot log file", PLY_COMMAND_OPTION_TYPE_FLAG, NULL); if (!ply_command_parser_parse_arguments (state.command_parser, state.loop, argv, argc)) @@ -2181,6 +2183,7 @@ main (int argc, "help", &should_help, "attach-to-session", &attach_to_session, "mode", &mode_string, + "no-boot-log", &no_boot_log, "no-daemon", &no_daemon, "debug", &debug, "debug-file", &debug_buffer_path, @@ -2237,6 +2240,8 @@ main (int argc, return EX_OSERR; } + state.no_boot_log = no_boot_log; + chdir ("/"); signal (SIGPIPE, SIG_IGN); -- 1.8.1.2