Teach systemd about the location of the hostname, distribution version file, and tweak the various m4 scripts in units/.
Signed-off-by: Ramkumar Ramachandra <artag...@gmail.com> --- Started using systemd on my Debian machine yesterday- here's a quick patch for starters. Thanks for reading. [Please CC me on replies; I'm not subscribed to the list] src/hostname-setup.c | 4 +++- src/util.c | 13 +++++++++++++ units/console-shell.service.m4 | 3 +++ units/getty@.service.m4 | 3 +++ units/serial-getty@.service.m4 | 3 +++ 5 files changed, 25 insertions(+), 1 deletions(-) diff --git a/src/hostname-setup.c b/src/hostname-setup.c index 2c2f10c..918525d 100644 --- a/src/hostname-setup.c +++ b/src/hostname-setup.c @@ -32,6 +32,8 @@ #if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA) #define FILENAME "/etc/sysconfig/network" +#elif defined(TARGET_DEBIAN) +#define FILENAME "/etc/hostname" #elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE) #define FILENAME "/etc/HOSTNAME" #elif defined(TARGET_ARCH) @@ -114,7 +116,7 @@ finish: fclose(f); return r; -#elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE) +#elif defined(TARGET_DEBIAN) || defined(TARGET_SUSE) || defined(TARGET_SLACKWARE) return read_and_strip_hostname(FILENAME, hn); #else return -ENOENT; diff --git a/src/util.c b/src/util.c index e93e6f6..8c0bad9 100644 --- a/src/util.c +++ b/src/util.c @@ -3612,6 +3612,19 @@ void status_welcome(void) { if (!ansi_color) const_color = "0;32"; /* Green for openSUSE */ +#elif defined(TARGET_DEBIAN) + + if (!pretty_name) { + if ((r = read_one_line_file("/etc/debian_version", &pretty_name)) < 0) { + + if (r != -ENOENT) + log_warning("Failed to read /etc/debian_version: %s", strerror(-r)); + } + } + + if (!ansi_color) + const_color = "0;31"; /* Red for Debian */ + #elif defined(TARGET_GENTOO) if (!pretty_name) { diff --git a/units/console-shell.service.m4 b/units/console-shell.service.m4 index 02adc84..461f40a 100644 --- a/units/console-shell.service.m4 +++ b/units/console-shell.service.m4 @@ -11,6 +11,9 @@ After=systemd-user-sessions.service plymouth-quit-wait.service m4_ifdef(`TARGET_FEDORA', After=rc-local.service )m4_dnl +m4_ifdef(`TARGET_DEBIAN', +After=rc-local.service +)m4_dnl m4_ifdef(`TARGET_ARCH', After=rc-local.service )m4_dnl diff --git a/units/getty@.service.m4 b/units/getty@.service.m4 index d2a145d..0e0cb19 100644 --- a/units/getty@.service.m4 +++ b/units/getty@.service.m4 @@ -12,6 +12,9 @@ After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service m4_ifdef(`TARGET_FEDORA', After=rc-local.service )m4_dnl +m4_ifdef(`TARGET_DEBIAN', +After=rc-local.service +)m4_dnl m4_ifdef(`TARGET_ARCH', After=rc-local.service )m4_dnl diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4 index e5f0ca6..e748cce 100644 --- a/units/serial-getty@.service.m4 +++ b/units/serial-getty@.service.m4 @@ -12,6 +12,9 @@ After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service m4_ifdef(`TARGET_FEDORA', After=rc-local.service )m4_dnl +m4_ifdef(`TARGET_DEBIAN', +After=rc-local.service +)m4_dnl m4_ifdef(`TARGET_ARCH', After=rc-local.service )m4_dnl -- 1.7.6.351.gb35ac.dirty _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel