chiark / gitweb /
vconsole: set keyboard mapping and font settings on Arch
[elogind.git] / src / vconsole-setup.c
index 8e4fedef0ed779b9856720888c01dd3722e32d2e..06d9a211911890d712b28663ba9beb052836342b 100644 (file)
@@ -168,31 +168,72 @@ int main(int argc, char **argv) {
         if (!(utf8 = is_locale_utf8()))
                 disable_utf8(fd);
 
-        if ((r = parse_env_file(
-                             "/etc/vconsole",
-                             NEWLINE,
-                             "VCONSOLE_KEYMAP", &vc_keymap,
-                             "VCONSOLE_FONT", &vc_font,
-                             "VCONSOLE_FONT_MAP", &vc_font_map,
-                             "VCONSOLE_FONT_UNIMAP", &vc_font_unimap,
-                             NULL)) < 0) {
+#ifdef TARGET_FEDORA
+        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_keymap,
+                                "KEYMAP", &vc_keymap,
+                                NULL)) < 0) {
+
+                if (r != -ENOENT)
+                        log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
+        }
+
+        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;
+        }
+#elif defined(TARGET_ARCH)
+        if ((r = parse_env_file("/etc/rc.conf", NEWLINE,
+                               "KEYMAP", &vc_keymap,
+                                "CONSOLEFONT", &vc_font,
+                                "CONSOLEMAP", &vc_font_map,
+                                NULL)) < 0) {
+
+                if (r != -ENOENT)
+                        log_warning("Failed to read /etc/rc.conf: %s", strerror(-r));
+        }
+#endif
+
+        /* Override distribution-specific options with the
+         * distribution-independent configuration */
+        if ((r = parse_env_file("/etc/vconsole", NEWLINE,
+                                "KEYMAP", &vc_keymap,
+                                "FONT", &vc_font,
+                                "FONT_MAP", &vc_font_map,
+                                "FONT_UNIMAP", &vc_font_unimap,
+                                NULL)) < 0) {
 
                 if (r != -ENOENT)
                         log_warning("Failed to read /etc/vconsole: %s", strerror(-r));
         }
 
-        if ((r = parse_env_file(
-                             "/proc/cmdline",
-                             WHITESPACE,
+        if ((r = parse_env_file("/proc/cmdline", WHITESPACE,
 #ifdef TARGET_FEDORA
-                             "SYSFONT", &vc_font,
-                             "KEYTABLE", &vc_keymap,
+                                "SYSFONT", &vc_font,
+                                "KEYTABLE", &vc_keymap,
 #endif
-                             "vconsole.keymap", &vc_keymap,
-                             "vconsole.font", &vc_font,
-                             "vconsole.font.map", &vc_font_map,
-                             "vconsole.font.unimap", &vc_font_unimap,
-                             NULL)) < 0) {
+                                "vconsole.keymap", &vc_keymap,
+                                "vconsole.font", &vc_font,
+                                "vconsole.font.map", &vc_font_map,
+                                "vconsole.font.unimap", &vc_font_unimap,
+                                NULL)) < 0) {
 
                 if (r != -ENOENT)
                         log_warning("Failed to read /proc/cmdline: %s", strerror(-r));