forked from pool/systemd
Frederic Crozat
9bf0c2c838
- Remove storage-after-cryptsetup.service, add storage-after-cryptsetup.patch instead to prevent dependency cycle (bnc#722539). - Add delay-fsck-cryptsetup-after-md-lvm-dmraid.patch: ensure fsck/cryptsetup is run after lvm/md/dmraid have landed (bnc#724912). - Add cron-tty-pam.patch: Fix cron filling logs (bnc#731358). - Add do_not_warn_pidfile.patch: Fix PID warning in logs (bnc#732912). - Add mount-swap-log.patch: Ensure swap and mount output is redirected to default log target (rhb#750032). - Add color-on-boot.patch: ensure colored status are displayed at boot time. - Update modules_on_boot.patch to fix bnc#732041. - Replace private_tmp_crash.patch with log_on_close.patch, better upstream fix for bnc#699829 and fix bnc#731719. - Update vconsole patch to fix memleaks and crash (bnc#734527). - Add handle-racy-daemon.patch: fix warnings with sendmail (bnc#732912). - Add new-lsb-headers.patch: support PIDFile: and X-Systemd-RemainAfterExit: header in initscript (bnc#727771). - Update bootsplash services to not start if vga= is missing from cmdline (bnc#727771) - Add lock-opensuse.patch: disable /var/lock/{subsys,lockdev} and change default permissions on /var/lock (bnc#733523). - Add garbage_collect_units: ensure error units are correctly garbage collected (rhb#680122). - Add crypt-loop-file.patch: add support for crypt file loop (bnc#730496). OBS-URL: https://build.opensuse.org/request/show/96123 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=228
132 lines
5.1 KiB
Diff
132 lines
5.1 KiB
Diff
From 5831e9b726ab6e76b28a94861a014d3bc2aa3015 Mon Sep 17 00:00:00 2001
|
|
From: Michal Schmidt <mschmidt@redhat.com>
|
|
Date: Thu, 10 Nov 2011 12:53:39 +0100
|
|
Subject: [PATCH] job: colored status messages on boot
|
|
|
|
The lack or green/red status marks on boot has been described by some
|
|
users as "critical", "dramatic", "dealbreaker", "showstopper". Seriously.
|
|
---
|
|
src/job.c | 13 +++++++------
|
|
src/unit.c | 24 ++++++++++++++++++++----
|
|
src/unit.h | 2 +-
|
|
3 files changed, 28 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/src/job.c b/src/job.c
|
|
index 20971da..1520d81 100644
|
|
--- a/src/job.c
|
|
+++ b/src/job.c
|
|
@@ -484,19 +484,20 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
|
|
switch (result) {
|
|
|
|
case JOB_DONE:
|
|
- unit_status_printf(u, "Started %s.\n", unit_description(u));
|
|
+ unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, "Started %s", unit_description(u));
|
|
break;
|
|
|
|
case JOB_FAILED:
|
|
- unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "failed" ANSI_HIGHLIGHT_OFF ", see 'systemctl status %s' for details.\n", unit_description(u), u->meta.id);
|
|
+ unit_status_printf(u, ANSI_HIGHLIGHT_ON "FAILED" ANSI_HIGHLIGHT_OFF, "Failed to start %s", unit_description(u));
|
|
+ unit_status_printf(u, NULL, "See 'systemctl status %s' for details.", u->meta.id);
|
|
break;
|
|
|
|
case JOB_DEPENDENCY:
|
|
- unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "aborted" ANSI_HIGHLIGHT_OFF " because a dependency failed.\n", unit_description(u));
|
|
+ unit_status_printf(u, ANSI_HIGHLIGHT_ON " ABORT" ANSI_HIGHLIGHT_OFF, "Dependency failed. Aborted start of %s", unit_description(u));
|
|
break;
|
|
|
|
case JOB_TIMEOUT:
|
|
- unit_status_printf(u, "Starting %s " ANSI_HIGHLIGHT_ON "timed out" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u), u->meta.id);
|
|
+ unit_status_printf(u, ANSI_HIGHLIGHT_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out starting %s", unit_description(u));
|
|
break;
|
|
|
|
default:
|
|
@@ -508,12 +509,12 @@ static void job_print_status_message(Unit *u, JobType t, JobResult result) {
|
|
switch (result) {
|
|
|
|
case JOB_TIMEOUT:
|
|
- unit_status_printf(u, "Stopping %s " ANSI_HIGHLIGHT_ON "timed out" ANSI_HIGHLIGHT_OFF ".\n", unit_description(u), u->meta.id);
|
|
+ unit_status_printf(u, ANSI_HIGHLIGHT_ON " TIME " ANSI_HIGHLIGHT_OFF, "Timed out stopping %s", unit_description(u));
|
|
break;
|
|
|
|
case JOB_DONE:
|
|
case JOB_FAILED:
|
|
- unit_status_printf(u, "Stopped %s.\n", unit_description(u));
|
|
+ unit_status_printf(u, ANSI_HIGHLIGHT_GREEN_ON " OK " ANSI_HIGHLIGHT_OFF, "Stopped %s", unit_description(u));
|
|
break;
|
|
|
|
default:
|
|
diff --git a/src/unit.c b/src/unit.c
|
|
index 903a8e4..ad4063b 100644
|
|
--- a/src/unit.c
|
|
+++ b/src/unit.c
|
|
@@ -924,7 +924,7 @@ int unit_start(Unit *u) {
|
|
|
|
unit_add_to_dbus_queue(u);
|
|
|
|
- unit_status_printf(u, "Starting %s...\n", unit_description(u));
|
|
+ unit_status_printf(u, NULL, "Starting %s...", unit_description(u));
|
|
return UNIT_VTABLE(u)->start(u);
|
|
}
|
|
|
|
@@ -966,7 +966,7 @@ int unit_stop(Unit *u) {
|
|
|
|
unit_add_to_dbus_queue(u);
|
|
|
|
- unit_status_printf(u, "Stopping %s...\n", unit_description(u));
|
|
+ unit_status_printf(u, NULL, "Stopping %s...", unit_description(u));
|
|
return UNIT_VTABLE(u)->stop(u);
|
|
}
|
|
|
|
@@ -2426,8 +2426,11 @@ int unit_coldplug(Unit *u) {
|
|
return 0;
|
|
}
|
|
|
|
-void unit_status_printf(Unit *u, const char *format, ...) {
|
|
+void unit_status_printf(Unit *u, const char *status, const char *format, ...) {
|
|
va_list ap;
|
|
+ char *s, *e;
|
|
+ int err;
|
|
+ const unsigned emax = status ? 80 - (sizeof("[ OK ]")-1) : 80;
|
|
|
|
assert(u);
|
|
assert(format);
|
|
@@ -2442,8 +2445,21 @@ void unit_status_printf(Unit *u, const char *format, ...) {
|
|
return;
|
|
|
|
va_start(ap, format);
|
|
- status_vprintf(format, ap);
|
|
+ err = vasprintf(&s, format, ap);
|
|
va_end(ap);
|
|
+ if (err < 0)
|
|
+ return;
|
|
+
|
|
+ e = ellipsize(s, emax, 100);
|
|
+ free(s);
|
|
+ if (!e)
|
|
+ return;
|
|
+
|
|
+ if (status)
|
|
+ status_printf("%s%*s[%s]\n", e, emax - strlen(e), "", status);
|
|
+ else
|
|
+ status_printf("%s\n", e);
|
|
+ free(e);
|
|
}
|
|
|
|
bool unit_need_daemon_reload(Unit *u) {
|
|
diff --git a/src/unit.h b/src/unit.h
|
|
index 7da5723..b32c1a7 100644
|
|
--- a/src/unit.h
|
|
+++ b/src/unit.h
|
|
@@ -512,7 +512,7 @@ int unit_add_node_link(Unit *u, const char *what, bool wants);
|
|
|
|
int unit_coldplug(Unit *u);
|
|
|
|
-void unit_status_printf(Unit *u, const char *format, ...);
|
|
+void unit_status_printf(Unit *u, const char *status, const char *format, ...);
|
|
|
|
bool unit_need_daemon_reload(Unit *u);
|
|
|
|
--
|
|
1.7.7
|
|
|