diff options
author | Andrey Borzenkov <arvidjaar@gmail.com> | 2011-03-08 19:47:29 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-03-08 19:47:36 +0100 |
commit | 1de4d79bf554946f486adf56ed765c5335816f15 (patch) | |
tree | 1a9959d84694b23fde107f59e74b3fab98be9e50 /src/util.c | |
parent | 6e25b33cddf77c90d351dee6442c51bd19e2b7a8 (diff) |
build-sys: add Mandriva distribution supportsystemd/v20
This merges several separate patches that I carry as part of
Mandriva systemd RPM. They touch those parts that are very
unlikely to be changed in near future and do not impose any
functionality change for systemd core. I also think it is
useful for troubleshooting to have real distribution name in
system logs, espicially when someone reports problem upstream.
The patch looks bigger than sum of replaced patches because
- previous patches were applied on top of distro=fedora, now
I need to add all those bits for distro=mandriva as well
- part of patch was done as spec file magic, but it seems more
logical to ship all these bits together
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index b02a77eed8..96cf6605f3 100644 --- a/src/util.c +++ b/src/util.c @@ -3252,6 +3252,32 @@ void status_welcome(void) { if (!ansi_color) const_color = "0;33"; /* Orange/Brown for Ubuntu */ +#elif defined(TARGET_MANDRIVA) + + if (!pretty_name) { + char *s, *p; + + if ((r = read_one_line_file("/etc/mandriva-release", &s) < 0)) { + if (r != -ENOENT) + log_warning("Failed to read /etc/mandriva-release: %s", strerror(-r)); + } else { + p = strstr(s, " release "); + if (p) { + *p = '\0'; + p += 9; + p[strcspn(p, " ")] = '\0'; + + /* This corresponds to standard rc.sysinit */ + if (asprintf(&pretty_name, "%s\x1B[0;39m %s", s, p) > 0) + const_color = "1;36"; + else + log_warning("Failed to allocate Mandriva version string."); + } else + log_warning("Failed to parse /etc/mandriva-release"); + free(s); + } + } + #endif if (!pretty_name && !const_pretty) |