]> err.no Git - systemd/commitdiff
build-sys: add Arch Linux support
authorDave Reisner <d@falconindy.com>
Wed, 5 May 2010 19:59:24 +0000 (21:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 5 May 2010 20:03:52 +0000 (22:03 +0200)
configure.ac
hostname-setup.c

index cc0ee11722f9bc7c5a868a14cb0991c7efc1edf3..95456cd0bc9ba41235ec3b9256ecebba9de9d39a 100644 (file)
@@ -84,6 +84,7 @@ 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")
+                AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
         fi
         if test "z$with_distro" = "z"; then
                 with_distro=`uname -s`
@@ -113,6 +114,13 @@ case $with_distro in
                 special_syslog_service=sysklogd.service
                 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
                 ;;
+        arch)
+                SYSTEM_SYSVINIT_PATH=/etc/rc.d
+                SYSTEM_SYSVRCND_PATH=/etc
+                special_dbus_service=dbus.service
+                special_syslog_service=syslog-ng.service
+                AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
+                ;;
         none)
                 SYSTEM_SYSVINIT_PATH=/fix/the/configure/script
                 SYSTEM_SYSVRCND_PATH=/fix/the/configure/script
@@ -130,6 +138,7 @@ AC_SUBST(SYSTEM_SYSVRCND_PATH)
 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_ARCH, test x"$with_distro" = xarch)
 
 AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$special_dbus_service"], [D-Bus service name])
 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$special_syslog_service"], [syslog service name])
index 5f3ee77ac01a61d3ffc94745d5609f967f47ba46..67891a52e62c9d82ef49faa86ad41a45774072d4 100644 (file)
@@ -75,6 +75,47 @@ finish:
         fclose(f);
         return r;
 
+#elif defined(TARGET_ARCH)
+        int r;
+        FILE *f;
+
+        assert(hn);
+
+        if (!(f = fopen("/etc/rc.conf", "re")))
+                return -errno;
+
+        for (;;) {
+                char line[LINE_MAX];
+                char *s, *k;
+
+                if (!fgets(line, sizeof(line), f)) {
+                        if (feof(f))
+                                break;
+
+                        r = -errno;
+                        goto finish;
+                }
+
+                s = strstrip(line);
+
+                if (!startswith(s, "HOSTNAME="))
+                        continue;
+
+                if (!(k = strdup(s+9))) {
+                        r = -ENOMEM;
+                        goto finish;
+                }
+
+                *hn = k;
+                break;
+        }
+
+        r = 0;
+
+finish:
+        fclose(f);
+        return r;
+
 #elif defined(TARGET_SUSE)
         int r;
         char *s, *k;