[systemd-devel] [PATCH] Debian: add hostname path, m4 units

Tollef Fog Heen tfheen at err.no
Fri Dec 2 06:05:01 PST 2011


]] Ramkumar Ramachandra 

| 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;

Not needed, the top of read_hostname from the same file.

| 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)

Already present, AFAICS?

| 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

There's no rc-local.service on Debian, it's rc.local.service if
anything, ditto for the rest of the patch.

-- 
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are


More information about the systemd-devel mailing list