summaryrefslogtreecommitdiff
path: root/src/vconsole-setup.c
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/vconsole-setup.c
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/vconsole-setup.c')
-rw-r--r--src/vconsole-setup.c61
1 files changed, 61 insertions, 0 deletions
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
}