[PATCH] Add Mageia support

Dexter Morgan dmorgan at mageia.org
Fri Oct 28 10:16:33 PDT 2011


This patch adds support for the Mageia Linux distribution:
 http://www.mageia.org/

Mageia is a fork of Mandriva although some divergence has already occured
and thus inclusion of these changes upstream allow us to (hopefully)
migrate more rapidly to the new standard approaches systemd offers.
Indeed, we already use the preferred mechanism of OS identification via
the /etc/os-release file rather than a distro specific variation.

This patch mostly mirrors the patch added previously for Mandriva
support. In addition to those original authors, this patch was mostly
written by Dexter Morgan with help from Colin Guthrie and Eugeni Dodonov.
---
 Makefile.am                    |   31 +++++++++++++++++++++++++++++++
 configure.ac                   |    8 ++++++++
 src/fsck.c                     |    2 +-
 src/hostname-setup.c           |    4 ++--
 src/locale-setup.c             |    2 +-
 src/quotacheck.c               |    6 +++---
 src/service.c                  |    3 ++-
 src/systemctl.c                |    2 +-
 src/vconsole-setup.c           |    4 ++--
 units/console-shell.service.m4 |    3 +++
 units/getty at .service.m4        |    3 +++
 units/mageia/prefdm.service    |   21 +++++++++++++++++++++
 units/rescue.service.m4        |    5 ++++-
 units/serial-getty at .service.m4 |    3 +++
 14 files changed, 85 insertions(+), 12 deletions(-)
 create mode 100644 units/mageia/prefdm.service

diff --git a/Makefile.am b/Makefile.am
index dabe32a..f701a45 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -119,6 +119,13 @@ AM_CPPFLAGS += \
 	-DKBD_LOADKEYS=\"/bin/loadkeys\" \
 	-DKBD_SETFONT=\"/bin/setfont\" \
 	-DDEFAULT_FONT=\"latarcyrheb-sun16\"
+else
+if TARGET_MAGEIA
+AM_CPPFLAGS += \
+	-DKBD_LOADKEYS=\"/bin/loadkeys\" \
+	-DKBD_SETFONT=\"/bin/setfont\" \
+	-DDEFAULT_FONT=\"LatArCyrHeb-16\"
+endif
 endif
 endif
 endif
@@ -542,6 +549,13 @@ dist_systemunit_DATA += \
 	units/suse/halt-local.service
 endif
 
+if TARGET_MAGEIA
+dist_systemunit_DATA += \
+	units/mageia/prefdm.service \
+	units/fedora/rc-local.service \
+	units/fedora/halt-local.service
+endif
+
 if HAVE_PLYMOUTH
 dist_systemunit_DATA += \
 	units/plymouth-start.service \
@@ -1999,6 +2013,23 @@ if TARGET_SUSE
 		$(LN_S) $(systemunitdir)/halt-local.service halt-local.service )
 endif
 
+if TARGET_MAGEIA
+	$(MKDIR_P) -m 0755 $(DESTDIR)$(systemunitdir)/final.target.wants
+	( cd $(DESTDIR)$(systemunitdir)/multi-user.target.wants && \
+		rm -f rc-local.service && \
+		$(LN_S) $(systemunitdir)/rc-local.service rc-local.service )
+	( cd $(DESTDIR)$(systemunitdir)/final.target.wants && \
+		rm -f halt-local.service && \
+		$(LN_S) $(systemunitdir)/halt-local.service halt-local.service )
+	( cd $(DESTDIR)$(systemunitdir) && \
+		rm -f display-manager.service && \
+		$(LN_S) prefdm.service display-manager.service && \
+		$(LN_S) prefdm.service dm.service )
+	( cd $(DESTDIR)$(systemunitdir)/graphical.target.wants && \
+		rm -f display-manager.service && \
+		$(LN_S) $(systemunitdir)/display-manager.service display-manager.service )
+endif
+
 if HAVE_SYSV_COMPAT
 	( cd $(DESTDIR)$(systemunitdir)/local-fs.target.wants && \
 		rm -f var-lock.mount && \
diff --git a/configure.ac b/configure.ac
index 0ec6f69..0bc9860 100644
--- a/configure.ac
+++ b/configure.ac
@@ -371,6 +371,7 @@ if test "z$with_distro" = "z"; then
                 test -f "/etc/mandriva-release" && with_distro="mandriva"
                 test -f "/etc/meego-release" && with_distro="meego"
                 test -f "/etc/angstrom-version" && with_distro="angstrom"
+                test -f "/etc/mageia-release" && with_distro="mageia"
                 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
                         with_distro="ubuntu"
                 fi
@@ -458,6 +459,12 @@ case $with_distro in
                 AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
                 M4_DEFINES=-DTARGET_ANGSTROM=1
                 ;;
+        mageia)
+                SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
+                AC_DEFINE(TARGET_MAGEIA, [], [Target is Mageia])
+                M4_DISTRO_FLAG=-DTARGET_MAGEIA=1
+                have_plymouth=yes
+                ;;
         other)
                 ;;
         *)
@@ -515,6 +522,7 @@ AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
 AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
+AM_CONDITIONAL(TARGET_MAGEIA, test x"$with_distro" = xmageia)
 
 AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
diff --git a/src/fsck.c b/src/fsck.c
index c5088ad..3477ba1 100644
--- a/src/fsck.c
+++ b/src/fsck.c
@@ -127,7 +127,7 @@ static int parse_proc_cmdline(void) {
                         arg_skip = true;
                 else if (startswith(w, "fsck.mode"))
                         log_warning("Invalid fsck.mode= parameter. Ignoring.");
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
                 else if (strneq(w, "fastboot", l))
                         arg_skip = true;
                 else if (strneq(w, "forcefsck", l))
diff --git a/src/hostname-setup.c b/src/hostname-setup.c
index 7216b75..2c2f10c 100644
--- a/src/hostname-setup.c
+++ b/src/hostname-setup.c
@@ -30,7 +30,7 @@
 #include "util.h"
 #include "log.h"
 
-#if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO)
+#if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA)
 #define FILENAME "/etc/sysconfig/network"
 #elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE)
 #define FILENAME "/etc/HOSTNAME"
@@ -64,7 +64,7 @@ static int read_and_strip_hostname(const char *path, char **hn) {
 
 static int read_distro_hostname(char **hn) {
 
-#if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO)
+#if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA) || defined(TARGET_MEEGO) || defined(TARGET_MAGEIA)
         int r;
         FILE *f;
 
diff --git a/src/locale-setup.c b/src/locale-setup.c
index 3402936..7f692e9 100644
--- a/src/locale-setup.c
+++ b/src/locale-setup.c
@@ -199,7 +199,7 @@ int locale_setup(void) {
                 if (r != -ENOENT)
                         log_warning("Failed to read /etc/profile.env: %s", strerror(-r));
         }
-#elif defined(TARGET_MANDRIVA)
+#elif defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA )
         if (r <= 0 &&
             (r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
                                 "LANG",              &variables[VARIABLE_LANG],
diff --git a/src/quotacheck.c b/src/quotacheck.c
index 98b59a0..60033a8 100644
--- a/src/quotacheck.c
+++ b/src/quotacheck.c
@@ -54,7 +54,7 @@ static int parse_proc_cmdline(void) {
                         arg_skip = true;
                 else if (startswith(w, "quotacheck.mode"))
                         log_warning("Invalid quotacheck.mode= parameter. Ignoring.");
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
                 else if (strneq(w, "forcequotacheck", l))
                         arg_force = true;
 #endif
@@ -65,8 +65,8 @@ static int parse_proc_cmdline(void) {
 }
 
 static void test_files(void) {
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
-        /* This exists only on Fedora or Mandriva */
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
+        /* This exists only on Fedora, Mandriva or Mageia */
         if (access("/forcequotacheck", F_OK) >= 0)
                 arg_force = true;
 #endif
diff --git a/src/service.c b/src/service.c
index 6184390..eb475d9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -277,7 +277,8 @@ static int sysv_translate_facility(const char *name, const char *filename, char
         static const char * const table[] = {
                 /* LSB defined facilities */
                 "local_fs",             SPECIAL_LOCAL_FS_TARGET,
-#ifndef TARGET_MANDRIVA
+#if defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
+#else
                 /* Due to unfortunate name selection in Mandriva,
                  * $network is provided by network-up which is ordered
                  * after network which actually starts interfaces.
diff --git a/src/systemctl.c b/src/systemctl.c
index 0de2444..21f8e27 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -3443,7 +3443,7 @@ finish:
 static int enable_sysv_units(char **args) {
         int r = 0;
 
-#if defined (HAVE_SYSV_COMPAT) && (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_SUSE) || defined(TARGET_MEEGO) || defined(TARGET_ALTLINUX))
+#if defined (HAVE_SYSV_COMPAT) && (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_SUSE) || defined(TARGET_MEEGO) || defined(TARGET_ALTLINUX) || defined(TARGET_MAGEIA))
         const char *verb = args[0];
         unsigned f = 1, t = 1;
         LookupPaths paths;
diff --git a/src/vconsole-setup.c b/src/vconsole-setup.c
index c5f3628..9196789 100644
--- a/src/vconsole-setup.c
+++ b/src/vconsole-setup.c
@@ -160,7 +160,7 @@ int main(int argc, char **argv) {
 #ifdef TARGET_GENTOO
         char *vc_unicode = NULL;
 #endif
-#ifdef TARGET_MANDRIVA
+#if defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
         char *vc_keytable = NULL;
 #endif
         int fd = -1;
@@ -371,7 +371,7 @@ int main(int argc, char **argv) {
                                 log_warning("Failed to read /etc/conf.d/keymaps: %s", strerror(-r));
                 }
 
-#elif defined(TARGET_MANDRIVA)
+#elif defined(TARGET_MANDRIVA) || defined (TARGET_MAGEIA)
 
                 if ((r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
                                         "SYSFONT", &vc_font,
diff --git a/units/console-shell.service.m4 b/units/console-shell.service.m4
index a4a9108..02adc84 100644
--- a/units/console-shell.service.m4
+++ b/units/console-shell.service.m4
@@ -23,6 +23,9 @@ After=rc-local.service
 m4_ifdef(`TARGET_MANDRIVA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_MAGEIA',
+After=rc-local.service
+)m4_dnl
 Before=getty.target
 
 [Service]
diff --git a/units/getty at .service.m4 b/units/getty at .service.m4
index 14d8187..d2a145d 100644
--- a/units/getty at .service.m4
+++ b/units/getty at .service.m4
@@ -24,6 +24,9 @@ After=rc-local.service
 m4_ifdef(`TARGET_MANDRIVA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_MAGEIA',
+After=rc-local.service
+)m4_dnl
 
 # If additional gettys are spawned during boot then we should make
 # sure that this is synchronized before getty.target, even though
diff --git a/units/mageia/prefdm.service b/units/mageia/prefdm.service
new file mode 100644
index 0000000..4a896bf
--- /dev/null
+++ b/units/mageia/prefdm.service
@@ -0,0 +1,21 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Display Manager
+After=livesys-late.service rc-local.service systemd-user-sessions.service
+After=network.target acpid.service fs.service haldaemon.service
+
+# Do not stop plymouth, it is done in prefdm if required
+Conflicts=plymouth-quit.service
+After=plymouth-quit.service
+
+[Service]
+ExecStart=/etc/X11/prefdm
+Type=forking
+Restart=always
+RestartSec=0
diff --git a/units/rescue.service.m4 b/units/rescue.service.m4
index 19b30d8..7dd8a22 100644
--- a/units/rescue.service.m4
+++ b/units/rescue.service.m4
@@ -25,10 +25,13 @@ ExecStart=-/bin/bash -c "exec ${SINGLE}"',
 m4_ifdef(`TARGET_MANDRIVA',
 `EnvironmentFile=/etc/sysconfig/init
 ExecStart=-/bin/bash -c "exec ${SINGLE}"',
+m4_ifdef(`TARGET_MAGEIA',
+`EnvironmentFile=/etc/sysconfig/init
+ExecStart=-/bin/bash -c "exec ${SINGLE}"',
 m4_ifdef(`TARGET_MEEGO',
 `EnvironmentFile=/etc/sysconfig/init
 ExecStart=-/bin/bash -c "exec ${SINGLE}"',
-`ExecStart=-/sbin/sulogin')))
+`ExecStart=-/sbin/sulogin'))))
 ExecStopPost=-/bin/systemctl --fail --no-block default
 StandardInput=tty-force
 StandardOutput=inherit
diff --git a/units/serial-getty at .service.m4 b/units/serial-getty at .service.m4
index 082290c..e5f0ca6 100644
--- a/units/serial-getty at .service.m4
+++ b/units/serial-getty at .service.m4
@@ -24,6 +24,9 @@ After=rc-local.service
 m4_ifdef(`TARGET_MANDRIVA',
 After=rc-local.service
 )m4_dnl
+m4_ifdef(`TARGET_MAGEIA',
+After=rc-local.service
+)m4_dnl
 
 # If additional gettys are spawned during boot then we should make
 # sure that this is synchronized before getty.target, even though
-- 
1.7.7.1


--------------010406060305030104010207--



More information about the systemd-devel mailing list