From: Lennart Poettering Date: Mon, 26 Jun 2017 18:42:08 +0000 (+0200) Subject: systemctl: quieten a few more messages if -q is specified X-Git-Tag: v234~86^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60675884cbf8c07a865bcd9a4b6cf93f0f6374f9;p=platform%2Fupstream%2Fsystemd.git systemctl: quieten a few more messages if -q is specified As suggested by @mbiebl in https://github.com/systemd/systemd/pull/6199 --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 012581e..4c5b14b 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -8269,12 +8269,14 @@ static int halt_now(enum action a) { switch (a) { case ACTION_HALT: - log_info("Halting."); + if (!arg_quiet) + log_info("Halting."); (void) reboot(RB_HALT_SYSTEM); return -errno; case ACTION_POWEROFF: - log_info("Powering off."); + if (!arg_quiet) + log_info("Powering off."); (void) reboot(RB_POWER_OFF); return -errno; @@ -8287,12 +8289,14 @@ static int halt_now(enum action a) { log_warning_errno(r, "Failed to read reboot parameter file: %m"); if (!isempty(param)) { - log_info("Rebooting with argument '%s'.", param); + if (!arg_quiet) + log_info("Rebooting with argument '%s'.", param); (void) syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, param); log_warning_errno(errno, "Failed to reboot with parameter, retrying without: %m"); } - log_info("Rebooting."); + if (!arg_quiet) + log_info("Rebooting."); (void) reboot(RB_AUTOBOOT); return -errno; } @@ -8353,7 +8357,8 @@ static int logind_schedule_shutdown(void) { if (r < 0) return log_warning_errno(r, "Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: %s", bus_error_message(&error, r)); - log_info("Shutdown scheduled for %s, use 'shutdown -c' to cancel.", format_timestamp(date, sizeof(date), arg_when)); + if (!arg_quiet) + log_info("Shutdown scheduled for %s, use 'shutdown -c' to cancel.", format_timestamp(date, sizeof(date), arg_when)); return 0; #else log_error("Cannot schedule shutdown without logind support, proceeding with immediate shutdown."); @@ -8481,7 +8486,9 @@ int main(int argc, char*argv[]) { goto finish; if (arg_action != ACTION_SYSTEMCTL && running_in_chroot() > 0) { - log_info("Running in chroot, ignoring request."); + + if (!arg_quiet) + log_info("Running in chroot, ignoring request."); r = 0; goto finish; }