summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrey Borzenkov <arvidjaar@gmail.com>2011-03-08 19:47:29 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-08 19:47:36 +0100
commit1de4d79bf554946f486adf56ed765c5335816f15 (patch)
tree1a9959d84694b23fde107f59e74b3fab98be9e50 /src
parent6e25b33cddf77c90d351dee6442c51bd19e2b7a8 (diff)
build-sys: add Mandriva distribution supportsystemd/v20
This merges several separate patches that I carry as part of Mandriva systemd RPM. They touch those parts that are very unlikely to be changed in near future and do not impose any functionality change for systemd core. I also think it is useful for troubleshooting to have real distribution name in system logs, espicially when someone reports problem upstream. The patch looks bigger than sum of replaced patches because - previous patches were applied on top of distro=fedora, now I need to add all those bits for distro=mandriva as well - part of patch was done as spec file magic, but it seems more logical to ship all these bits together
Diffstat (limited to 'src')
-rw-r--r--src/fsck.c2
-rw-r--r--src/hostname-setup.c4
-rw-r--r--src/locale-setup.c22
-rw-r--r--src/quotacheck.c6
-rw-r--r--src/service.c6
-rw-r--r--src/systemctl.c2
-rw-r--r--src/util.c26
-rw-r--r--src/vconsole-setup.c61
8 files changed, 122 insertions, 7 deletions
diff --git a/src/fsck.c b/src/fsck.c
index 7855f3ac07..dbfb47517f 100644
--- a/src/fsck.c
+++ b/src/fsck.c
@@ -121,7 +121,7 @@ static int parse_proc_cmdline(void) {
arg_skip = true;
else if (startswith(w, "fsck.mode"))
log_warning("Invalid fsck.mode= parameter. Ignoring.");
-#ifdef TARGET_FEDORA
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
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 8b0ff79384..ef68d78395 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)
+#if defined(TARGET_FEDORA) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA)
#define FILENAME "/etc/sysconfig/network"
#elif defined(TARGET_SUSE) || defined(TARGET_SLACKWARE) || defined(TARGET_FRUGALWARE)
#define FILENAME "/etc/HOSTNAME"
@@ -87,7 +87,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)
+#if defined(TARGET_FEDORA) || defined(TARGET_ARCH) || defined(TARGET_GENTOO) || defined(TARGET_ALTLINUX) || defined(TARGET_MANDRIVA)
int r;
FILE *f;
diff --git a/src/locale-setup.c b/src/locale-setup.c
index 2360cea85b..7684681cca 100644
--- a/src/locale-setup.c
+++ b/src/locale-setup.c
@@ -181,6 +181,28 @@ int locale_setup(void) {
if (r != -ENOENT)
log_warning("Failed to read /etc/profile.env: %s", strerror(-r));
}
+#elif defined(TARGET_MANDRIVA)
+ if (r <= 0 &&
+ (r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
+ "LANG", &variables[VARIABLE_LANG],
+ "LC_CTYPE", &variables[VARIABLE_LC_CTYPE],
+ "LC_NUMERIC", &variables[VARIABLE_LC_NUMERIC],
+ "LC_TIME", &variables[VARIABLE_LC_TIME],
+ "LC_COLLATE", &variables[VARIABLE_LC_COLLATE],
+ "LC_MONETARY", &variables[VARIABLE_LC_MONETARY],
+ "LC_MESSAGES", &variables[VARIABLE_LC_MESSAGES],
+ "LC_PAPER", &variables[VARIABLE_LC_PAPER],
+ "LC_NAME", &variables[VARIABLE_LC_NAME],
+ "LC_ADDRESS", &variables[VARIABLE_LC_ADDRESS],
+ "LC_TELEPHONE", &variables[VARIABLE_LC_TELEPHONE],
+ "LC_MEASUREMENT", &variables[VARIABLE_LC_MEASUREMENT],
+ "LC_IDENTIFICATION", &variables[VARIABLE_LC_IDENTIFICATION],
+ NULL)) < 0) {
+
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
+ }
+
#endif
if (!variables[VARIABLE_LANG]) {
diff --git a/src/quotacheck.c b/src/quotacheck.c
index 5d61146d93..5ced93318e 100644
--- a/src/quotacheck.c
+++ b/src/quotacheck.c
@@ -50,7 +50,7 @@ static int parse_proc_cmdline(void) {
arg_skip = true;
else if (startswith(w, "quotacheck.mode"))
log_warning("Invalid quotacheck.mode= parameter. Ignoring.");
-#ifdef TARGET_FEDORA
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
else if (strneq(w, "forcequotacheck", l))
arg_force = true;
#endif
@@ -61,8 +61,8 @@ static int parse_proc_cmdline(void) {
}
static void test_files(void) {
-#ifdef TARGET_FEDORA
- /* This exists only on Fedora */
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
+ /* This exists only on Fedora or Mandriva */
if (access("/forcequotacheck", F_OK) >= 0)
arg_force = true;
#endif
diff --git a/src/service.c b/src/service.c
index e99dfcd4a2..70999f3545 100644
--- a/src/service.c
+++ b/src/service.c
@@ -275,7 +275,13 @@ 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
+ /* Due to unfortunate name selection in Mandriva,
+ * $network is provided by network-up which is ordered
+ * after network which actually starts interfaces.
+ * To break the loop, just ignore it */
"network", SPECIAL_NETWORK_TARGET,
+#endif
"named", SPECIAL_NSS_LOOKUP_TARGET,
"portmap", SPECIAL_RPCBIND_TARGET,
"remote_fs", SPECIAL_REMOTE_FS_TARGET,
diff --git a/src/systemctl.c b/src/systemctl.c
index 23e659756f..63e74d904a 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4042,7 +4042,7 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
}
if (!f) {
-#if defined(TARGET_FEDORA) && defined (HAVE_SYSV_COMPAT)
+#if (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)) && defined (HAVE_SYSV_COMPAT)
if (endswith(i->name, ".service")) {
char *sysv;
diff --git a/src/util.c b/src/util.c
index b02a77eed8..96cf6605f3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3252,6 +3252,32 @@ void status_welcome(void) {
if (!ansi_color)
const_color = "0;33"; /* Orange/Brown for Ubuntu */
+#elif defined(TARGET_MANDRIVA)
+
+ if (!pretty_name) {
+ char *s, *p;
+
+ if ((r = read_one_line_file("/etc/mandriva-release", &s) < 0)) {
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/mandriva-release: %s", strerror(-r));
+ } else {
+ p = strstr(s, " release ");
+ if (p) {
+ *p = '\0';
+ p += 9;
+ p[strcspn(p, " ")] = '\0';
+
+ /* This corresponds to standard rc.sysinit */
+ if (asprintf(&pretty_name, "%s\x1B[0;39m %s", s, p) > 0)
+ const_color = "1;36";
+ else
+ log_warning("Failed to allocate Mandriva version string.");
+ } else
+ log_warning("Failed to parse /etc/mandriva-release");
+ free(s);
+ }
+ }
+
#endif
if (!pretty_name && !const_pretty)
diff --git a/src/vconsole-setup.c b/src/vconsole-setup.c
index 1952dfb0f1..5b977126fa 100644
--- a/src/vconsole-setup.c
+++ b/src/vconsole-setup.c
@@ -147,6 +147,9 @@ int main(int argc, char **argv) {
#ifdef TARGET_GENTOO
char *vc_unicode = NULL;
#endif
+#ifdef TARGET_MANDRIVA
+ char *vc_keytable = NULL;
+#endif
int fd = -1;
bool utf8;
int r = EXIT_FAILURE;
@@ -345,6 +348,64 @@ int main(int argc, char **argv) {
if (r != -ENOENT)
log_warning("Failed to read /etc/conf.d/keymaps: %s", strerror(-r));
}
+
+#elif defined(TARGET_MANDRIVA)
+
+ if ((r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
+ "SYSFONT", &vc_font,
+ "SYSFONTACM", &vc_font_map,
+ "UNIMAP", &vc_font_unimap,
+ NULL)) < 0) {
+
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
+ }
+
+ if ((r = parse_env_file("/etc/sysconfig/keyboard", NEWLINE,
+ "KEYTABLE", &vc_keytable,
+ "KEYMAP", &vc_keymap,
+ "UNIKEYTABLE", &vc_keymap,
+ "GRP_TOGGLE", &vc_keymap_toggle,
+ NULL)) < 0) {
+
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
+ }
+
+ if (vc_keytable) {
+ if (vc_keymap)
+ free(vc_keymap);
+ if (utf8) {
+ if (endswith(vc_keytable, ".uni") || strstr(vc_keytable, ".uni."))
+ vc_keymap = strdup(vc_keytable);
+ else {
+ char *s;
+ if ((s = strstr(vc_keytable, ".map")))
+ vc_keytable[s-vc_keytable+1] = '\0';
+ vc_keymap = strappend(vc_keytable, ".uni");
+ }
+ } else
+ vc_keymap = strdup(vc_keytable);
+
+ free(vc_keytable);
+
+ if (!vc_keymap) {
+ log_error("Out of memory.");
+ goto finish;
+ }
+ }
+
+ if (access("/etc/sysconfig/console/default.kmap", F_OK) >= 0) {
+ char *t;
+
+ if (!(t = strdup("/etc/sysconfig/console/default.kmap"))) {
+ log_error("Out of memory.");
+ goto finish;
+ }
+
+ free(vc_keymap);
+ vc_keymap = t;
+ }
#endif
}