[systemd-commits] 2 commits - configure.ac Makefile.am src/locale-setup.c src/service.c src/util.c units/getty at .service.m4 units/multi-user.target.m4

Lennart Poettering lennart at kemper.freedesktop.org
Mon Oct 25 12:10:25 PDT 2010


 Makefile.am                |    6 ++++--
 configure.ac               |   15 +++++++++++++--
 src/locale-setup.c         |    2 +-
 src/service.c              |    4 ++--
 src/util.c                 |   14 ++++++++++++++
 units/getty at .service.m4    |    1 +
 units/multi-user.target.m4 |    4 +++-
 7 files changed, 38 insertions(+), 8 deletions(-)

New commits:
commit 274914f99191e466bc523eadba74f52db8433189
Author: Andrew Edmunds <Andrew.Edmunds at yahoo.com.au>
Date:   Mon Oct 25 23:23:21 2010 +1000

    util: Add welcome message for Ubuntu
    
    The approved method for determining the installed release of
    Ubuntu is to execute "lsb_release".  However, this is in /usr/bin and
    is implemented in python so it is not safe to execute at this early
    stage of booting.  This code parses /etc/lsb-release which is
    where "lsb_release" looks for the information.

diff --git a/src/util.c b/src/util.c
index 98422b2..973cee1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3025,6 +3025,20 @@ void status_welcome(void) {
         status_printf("Welcome to Debian \x1B[1;31m%s\x1B[0m!\n", r); /* Light Red for Debian */
 
         free(r);
+#elif defined(TARGET_UBUNTU)
+        char *desc = NULL;
+        char *codename = NULL;
+
+        if (parse_env_file("/etc/lsb-release", NEWLINE,
+                "DISTRIB_DESCRIPTION", &desc,
+                "DISTRIB_CODENAME", &codename, NULL) < 0)
+                return;
+        if (desc && codename)
+                /* Light Red for Ubuntu */
+                status_printf("Welcome to \x1B[1;31m%s\x1B[0m (%s)\n",
+                        desc, codename);
+        free(desc);
+        free(codename);
 #elif defined(TARGET_ARCH)
         status_printf("Welcome to \x1B[1;36mArch Linux\x1B[0m!\n"); /* Cyan for Arch */
 #else

commit 858dae181bb5461201ac1c04732d3ef4c67a0256
Author: Andrew Edmunds <Andrew.Edmunds at yahoo.com.au>
Date:   Mon Oct 25 23:22:28 2010 +1000

    ubuntu: Treat Ubuntu as a distinct distro in configure.ac etc
    
    Previously Ubuntu was treated as being equivalent to Debian, but the two
    distributions require different behaviour in certain places.  This commit does
    not change the behaviour of systemd on either distro but it creates a
    framework for changes to be introduced by later commits.
    
    The following previously meant "Target is Debian or Ubuntu".
        * configure option "--with-distro=debian"
        * C preprocessor symbol "TARGET_DEBIAN"
        * Automake conditional "TARGET_DEBIAN"
    After this commit, all of the above are redefined to mean "Target is Debian"
    
    The following are introduced to mean "Target is Ubuntu".
        * configure option "--with-distro=ubuntu"
        * C preprocessor symbol "TARGET_UBUNTU"
        * Automake conditional "TARGET_UBUNTU"
    
    Most code written for Debian will also be applicable to Ubuntu. An extra
    Automake conditional "TARGET_DEBIAN_OR_UBUNTU" is introduced to avoid
    duplication of code that would otherwise occur.
    
    This commit updates configure.ac, Makefile.am and distro-specific source files
    in line with the above definitions.

diff --git a/Makefile.am b/Makefile.am
index 77d1fc9..b6cae41 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -303,7 +303,7 @@ dist_systemunit_DATA += \
 	units/fedora/plymouth-halt.service
 endif
 
-if TARGET_DEBIAN
+if TARGET_DEBIAN_OR_UBUNTU
 dist_systemunit_DATA += \
 	units/debian/fsck.target \
 	units/debian/umountfs.service \
@@ -1218,7 +1218,7 @@ if TARGET_GENTOO
 		rm -f xdm.service && \
 		$(LN_S) $(systemunitdir)/xdm.service xdm.service )
 endif
-if TARGET_DEBIAN
+if TARGET_DEBIAN_OR_UBUNTU
 	$(MKDIR_P) -m 0755 \
 		$(DESTDIR)$(systemunitdir)/umount.target.wants
 	( cd $(DESTDIR)$(systemunitdir)/umount.target.wants && \
@@ -1232,11 +1232,13 @@ if TARGET_DEBIAN
 endif
 if !TARGET_SUSE
 if !TARGET_DEBIAN
+if !TARGET_UBUNTU
 	( cd $(DESTDIR)$(systemunitdir) && \
 		rm -f fsck.target && \
 		$(LN_S) sysinit.target fsck.target )
 endif
 endif
+endif
 
 DISTCHECK_CONFIGURE_FLAGS = \
 	--with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \
diff --git a/configure.ac b/configure.ac
index 4f22b1b..a9f9e1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -251,7 +251,7 @@ AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
 
 AC_PATH_PROG([M4], [m4])
 
-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, arch, gentoo, slackware or other]))
+AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, ubuntu, arch, gentoo, slackware or other]))
 if test "z$with_distro" = "z"; then
         if test "$cross_compiling" = yes; then
                 AC_MSG_WARN([Target distribution cannot be reliably detected when cross-compiling. You should specify it with --with-distro (see $0 --help for recognized distros)])
@@ -259,6 +259,9 @@ if test "z$with_distro" = "z"; then
                 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
                 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
                 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
+                if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
+                        with_distro="ubuntu"
+                fi
                 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
                 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
                 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
@@ -305,9 +308,15 @@ case $with_distro in
         debian)
                 SYSTEM_SYSVRCND_PATH=/etc
                 SPECIAL_SYSLOG_SERVICE=rsyslog.service
-                AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
+                AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
                 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
                 ;;
+        ubuntu)
+                SYSTEM_SYSVRCND_PATH=/etc
+                SPECIAL_SYSLOG_SERVICE=rsyslog.service
+                AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
+                M4_DISTRO_FLAG=-DTARGET_UBUNTU=1
+                ;;
         arch)
                 SYSTEM_SYSVINIT_PATH=/etc/rc.d
                 SYSTEM_SYSVRCND_PATH=/etc
@@ -372,6 +381,8 @@ fi
 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
+AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
+AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
diff --git a/src/locale-setup.c b/src/locale-setup.c
index ffb4ee9..b3375e9 100644
--- a/src/locale-setup.c
+++ b/src/locale-setup.c
@@ -135,7 +135,7 @@ int locale_setup(void) {
                         log_warning("Failed to read /etc/sysconfig/language: %s", strerror(-r));
         }
 
-#elif defined(TARGET_DEBIAN)
+#elif defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
         if (r <= 0 &&
             (r = parse_env_file("/etc/default/locale", NEWLINE,
                                 "LANG", &variables[VARIABLE_LANG],
diff --git a/src/service.c b/src/service.c
index 6d6c540..7a522bf 100644
--- a/src/service.c
+++ b/src/service.c
@@ -65,7 +65,7 @@ static const struct {
         { "boot.d", SPECIAL_SYSINIT_TARGET,   RUNLEVEL_SYSINIT },
 #endif
 
-#ifdef TARGET_DEBIAN
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
         /* Debian style rcS.d */
         { "rcS.d",  SPECIAL_SYSINIT_TARGET,   RUNLEVEL_SYSINIT },
 #endif
@@ -274,7 +274,7 @@ static int sysv_translate_facility(const char *name, const char *filename, char
                 "time",                 SPECIAL_RTC_SET_TARGET,
 
                 /* Debian extensions */
-#ifdef TARGET_DEBIAN
+#if defined(TARGET_DEBIAN) || defined(TARGET_UBUNTU)
                 "mail-transport-agent", SPECIAL_MAIL_TRANSFER_AGENT_TARGET,
 #endif
                 "mail-transfer-agent",  SPECIAL_MAIL_TRANSFER_AGENT_TARGET,
diff --git a/units/getty at .service.m4 b/units/getty at .service.m4
index 4691ea7..98c6a88 100644
--- a/units/getty at .service.m4
+++ b/units/getty at .service.m4
@@ -8,6 +8,7 @@
 m4_ifdef(`TARGET_FEDORA', `m4_define(`GETTY', `/sbin/mingetty')')m4_dnl
 m4_ifdef(`TARGET_SUSE', `m4_define(`GETTY', `/sbin/mingetty')')m4_dnl
 m4_ifdef(`TARGET_DEBIAN', `m4_define(`GETTY', `/sbin/getty 38400')')m4_dnl
+m4_ifdef(`TARGET_UBUNTU', `m4_define(`GETTY', `/sbin/getty 38400')')m4_dnl
 m4_ifdef(`TARGET_GENTOO', `m4_define(`GETTY', `/sbin/agetty 38400')')m4_dnl
 m4_ifdef(`TARGET_ARCH', `m4_define(`GETTY', `/sbin/agetty -8 38400')')m4_dnl
 m4_dnl
diff --git a/units/multi-user.target.m4 b/units/multi-user.target.m4
index cf290e7..8f8903f 100644
--- a/units/multi-user.target.m4
+++ b/units/multi-user.target.m4
@@ -21,9 +21,11 @@ m4_ifdef(`TARGET_SUSE',
 Names=runlevel3.target
 )m4_dnl
 m4_ifdef(`TARGET_DEBIAN',
-m4_dnl On Debian Runlevel 2, 3, 4 and 5 are multi-user
+m4_ifdef(`TARGET_UBUNTU',
+m4_dnl On Debian/Ubuntu Runlevel 2, 3, 4 and 5 are multi-user
 Names=runlevel2.target runlevel3.target runlevel4.target runlevel5.target
 )m4_dnl
+)m4_dnl
 AllowIsolate=yes
 
 [Install]



More information about the systemd-commits mailing list