[PATCH 2/2] honor keyboard settings
by Joshua C.
>From 3d21005462dcd92580e1d20f227e51280ff4c9c4 Mon Sep 17 00:00:00 2001
From: Live System User <liveuser(a)localhost.localdomain>
Date: Thu, 8 Aug 2013 20:07:40 +0200
Subject: [PATCH] honor keyboard settings
---
imgcreate/keyboard_old.py | 95 +++++++++++++++++++++++++++++++++++++++++++++++
imgcreate/kickstart.py | 10 +++--
2 files changed, 101 insertions(+), 4 deletions(-)
create mode 100644 imgcreate/keyboard_old.py
diff --git a/imgcreate/keyboard_old.py b/imgcreate/keyboard_old.py
new file mode 100644
index 0000000..da10b35
--- /dev/null
+++ b/imgcreate/keyboard_old.py
@@ -0,0 +1,95 @@
+#
+# keyboard.py - keyboard backend data object
+#
+# Brent Fox <bfox(a)redhat.com>
+# Mike Fulbright <msf(a)redhat.com>
+# Jeremy Katz <katzj(a)redhat.com>
+# Lubomir Rintel <lkundrak(a)v3.sk>
+#
+# Copyright 2002 Red Hat, Inc.
+# Copyright 2009 Lubomir Rintel
+#
+# This program 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# This file was adjusted for livecd-tools.f19
+
+import dbus
+import string
+import os
+import system_config_keyboard.keyboard_models as keyboard_models
+
+class Keyboard_old():
+ def __init__(self):
+ self._mods = keyboard_models.KeyboardModels()
+
+ self.type = "PC"
+ self.beenset = 0
+ self.config = []
+
+ # default to us
+ self.set("us")
+
+ try:
+ bus = dbus.SystemBus()
+ hal =
dbus.Interface(bus.get_object("org.freedesktop.Hal","/org/freedesktop/Hal/Manager"),"org.freedesktop.Hal.Manager")
+ kbs = hal.FindDeviceByCapability("input.keyboard")
+ if len(kbs) == 0:
+ self.type = "Serial"
+ else:
+ self._var ("KEYBOARDTYPE", "pc")
+ kb = dbus.Interface(bus.get_object("org.freedesktop.Hal",
kbs[0]), 'org.freedesktop.Hal.Device')
+ if kb.GetPropertyString("info.product").startswith("Sun Type"):
+ self.type == "Sun"
+ self._var ("KEYBOARDTYPE", "sun")
+ except:
+ pass
+
+ def _get_models(self):
+ return self._mods.get_models()
+ modelDict = property(_get_models)
+
+ def _var (self, name, value = None):
+ found = 0
+ for line in self.config:
+ if line[1] == name:
+ found = 1
+ break
+ if not found:
+ line = [None, None, None]
+ # get or set?
+ if not value:
+ return line[2]
+ line[1:3] = (name, value)
+ line[0] = '{0}="{1}"\n'.format (name, value)
+ if not found:
+ self.config.append (line)
+
+ def set(self, keytable):
+ if self.type != "Serial":
+ kb = self.modelDict[keytable]
+ self._var ("KEYTABLE", keytable)
+ self._var ("MODEL", kb[2])
+ self._var ("LAYOUT", kb[1])
+ self._var ("VARIANT", kb[3])
+ self._var ("OPTIONS", kb[4])
+
+ def write(self, instPath = "/"):
+ file = open(instPath + "/etc/sysconfig/keyboard", "w")
+ for line in self.config:
+ file.write (line[0]);
+ try:
+ os.unlink(instPath + "/etc/sysconfig/console/default.kmap")
+ except:
+ pass
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index 1059801..db71a1c 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -25,10 +25,7 @@ import logging
import urlgrabber
import selinux
-try:
- import system_config_keyboard.keyboard as keyboard
-except ImportError:
- import rhpl.keyboard as keyboard
+import keyboard_old as keyboard
import pykickstart.commands as kscommands
import pykickstart.constants as ksconstants
@@ -153,6 +150,11 @@ class KeyboardConfig(KickstartConfig):
f.write('FONT="%s"\n' % DEFAULT_VC_FONT)
except IOError as e:
logging.error("Cannot write vconsole configuration file: %s" % e)
+
+ k = keyboard.Keyboard_old()
+ if kskeyboard.keyboard:
+ k.set(kskeyboard.keyboard)
+ k.write(self.instroot)
class TimezoneConfig(KickstartConfig):
"""A class to apply a kickstart timezone configuration to a system."""
--
1.8.3.1
--
--joshua
10 years, 8 months
[PATCH 1/2] apply the keyboard language settings on boot
by Joshua C.
>From ab83b322353e74f9b89ad1df667198fa5e812591 Mon Sep 17 00:00:00 2001
From: Live System User <liveuser(a)localhost.localdomain>
Date: Thu, 8 Aug 2013 23:38:22 +0200
Subject: [PATCH] apply the keyboard language settings on boot
---
fedora-live-base.ks | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 169 insertions(+)
diff --git a/fedora-live-base.ks b/fedora-live-base.ks
index 7227308..9cfdfa5 100644
--- a/fedora-live-base.ks
+++ b/fedora-live-base.ks
@@ -223,6 +223,173 @@ fi
# https://bugzilla.redhat.com/show_bug.cgi?id=679486
echo "localhost" > /etc/hostname
+# Apply the keyboard settings from "/etc/sysconfig/keyboard"
+mkdir -p /etc/X11/xinit/xinitrc.d/
+cat > /etc/X11/xinit/xinitrc.d/keyboard.py << KEYBOARD_PY_EOF
+#
+# keyboard.py - keyboard backend data object
+#
+# Brent Fox <bfox(a)redhat.com>
+# Mike Fulbright <msf(a)redhat.com>
+# Jeremy Katz <katzj(a)redhat.com>
+# Lubomir Rintel <lkundrak(a)v3.sk>
+#
+# Copyright 2002 Red Hat, Inc.
+# Copyright 2009 Lubomir Rintel
+#
+# This program 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+import dbus
+import string
+import os
+from subprocess import call
+import system_config_keyboard.keyboard_models as keyboard_models
+
+class Keyboard():
+ def __init__(self):
+ self._mods = keyboard_models.KeyboardModels()
+
+ self.type = "PC"
+ self.beenset = 0
+ self.config = []
+
+ # default to us
+ self.set("us")
+
+ try:
+ bus = dbus.SystemBus()
+ hal =
dbus.Interface(bus.get_object("org.freedesktop.Hal","/org/freedesktop/Hal/Manager"),"org.freedesktop.Hal.Manager")
+ kbs = hal.FindDeviceByCapability("input.keyboard")
+ if len(kbs) == 0:
+ self.type = "Serial"
+ else:
+ self._var ("KEYBOARDTYPE", "pc")
+ kb = dbus.Interface(bus.get_object("org.freedesktop.Hal",
kbs[0]), 'org.freedesktop.Hal.Device')
+ if kb.GetPropertyString("info.product").startswith("Sun Type"):
+ self.type == "Sun"
+ self._var ("KEYBOARDTYPE", "sun")
+ except:
+ pass
+
+ def _get_models(self):
+ return self._mods.get_models()
+ modelDict = property(_get_models)
+
+ def _var (self, name, value = None):
+ found = 0
+ for line in self.config:
+ if line[1] == name:
+ found = 1
+ break
+ if not found:
+ line = [None, None, None]
+ # get or set?
+ if not value:
+ return line[2]
+ line[1:3] = (name, value)
+ line[0] = '{0}="{1}"\n'.format (name, value)
+ if not found:
+ self.config.append (line)
+
+ def set(self, keytable):
+ if self.type != "Serial":
+ kb = self.modelDict[keytable]
+ self._var ("KEYTABLE", keytable)
+ self._var ("MODEL", kb[2])
+ self._var ("LAYOUT", kb[1])
+ self._var ("VARIANT", kb[3])
+ self._var ("OPTIONS", kb[4])
+
+ def get(self):
+ return self._var ("KEYTABLE")
+
+ def read(self, instPath = "/"):
+ try:
+ file = open(instPath + "/etc/sysconfig/keyboard", "r")
+ except:
+ return
+ self.config = []
+ while 1:
+ line = file.readline ()
+ if not line:
+ break
+ (name, value) = line.rstrip("\n").split ('=')
+ self.config.append ([line, name, value.strip ('"'), 0])
+ self.beenset = 1
+
+ def activate(self):
+ # XXX do isys.loadkeys
+ console_kbd = self.get()
+ if not console_kbd:
+ return
+
+ # Call loadkeys to change the console keymap
+ if os.access("/bin/loadkeys", os.X_OK):
+ command = "/bin/loadkeys"
+ elif os.access("/usr/bin/loadkeys", os.X_OK):
+ command = "/usr/bin/loadkeys"
+ else:
+ command = "/bin/loadkeys"
+ argv = [ command, console_kbd ]
+
+ if os.access(argv[0], os.X_OK) == 1:
+ call (argv)
+
+ try:
+ kbd = self.modelDict[console_kbd]
+ except KeyError:
+ return
+
+ if not kbd:
+ return
+ (name, layout, model, variant, options) = kbd
+
+ # only set the X keyboard map if running X
+ if not os.environ.has_key("DISPLAY"):
+ return
+
+ argv = [ "/usr/bin/setxkbmap", "-layout", layout ]
+
+ # XXX setxkbmap(1) needs one -option flag for each option
+ if options:
+ argv = argv + [ "-option", options ]
+
+ if variant:
+ argv = argv + [ "-variant", variant ]
+
+ if os.access(argv[0], os.X_OK) == 1:
+ call (argv)
+
+def ActivateKeyboard():
+ kbd = Keyboard()
+ kbd.read()
+ kbd.set(kbd.get())
+ kbd.activate()
+
+if __name__ == "__main__":
+ ActivateKeyboard()
+KEYBOARD_PY_EOF
+
+cat > /etc/X11/xinit/xinitrc.d/set-keyboard.sh << SET_KEYBOARD_SH_EOF
+#!/bin/sh
+
+export PYTHONPATH=/usr/share/system-config-keyboard
+/usr/bin/python /etc/X11/xinit/xinitrc.d/keyboard.py \$*
+SET_KEYBOARD_SH_EOF
+
EOF
# bah, hal starts way too late
@@ -289,6 +456,8 @@ chmod 755 /etc/rc.d/init.d/livesys-late
/sbin/restorecon /etc/rc.d/init.d/livesys-late
/sbin/chkconfig --add livesys-late
+chmod 755 /etc/X11/xinit/xinitrc.d/set-keyboard.sh
+
# enable tmpfs for /tmp
systemctl enable tmp.mount
--
1.8.3.1
--
--joshua
10 years, 8 months
[PATCH 0/2] Fix: honor keyboard language setting in a livecd image
by Joshua C.
Since system-config-keyboard switched to dbus, it no longer works
reliably to set the keyboard settings at boot. As a consequence we
cannot create a working livecd-image that honor the keyboard settings
in the kickstart file. These patches fix the problem.
The first patch is for spin-kickstarts and reads and applies the
desired keyboard settings from /etc/sysconfig/keyboard. The second
patch is for livecd-tools and writes the settings specified in the
kickstart file to /etc/sysconfig/keyboard so that they can be read at
boot.
I tested these with several combinations and it works with
--vconsole=xxx and --xlayouts=xxx without glitches. Comments are
welcome.
--
--joshua
10 years, 8 months
livecd-creator doesn't honor keyboard settings in f19
by Joshua C.
I tried all of the following in my kickstart file:
keyboard --vconsole=de-latin1-nodeadkyes --xlayouts='de (nodeadkyes)' de
as well as any possible combination of these. In all cases my custom
f19-livecd-kde image was created with "layout=us"!!!
I have:
lang en_US.utf-8
keyboard --vconsole=de-latin1-nodeadkyes --xlayouts='de (nodeadkyes)' de
timezone Europe/Paris
I also looked in the official i18l-kickstarts and the
anaconda/kickstart wiki - without luck.
What am I missing?
--
--joshua
10 years, 8 months
Makefile
by Brian C. Lane
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 0055de4a0dc5669b56895a684c62510ba09f5b61
Author: Brian C. Lane <bcl(a)redhat.com>
Date: Wed Aug 7 11:27:18 2013 -0700
Version 20.0
diff --git a/Makefile b/Makefile
index 1656d72..16fe3f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 19.6
+VERSION = 20.0
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
10 years, 8 months
Makefile
by Brian C. Lane
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 0ec5ab3c2b88d36298eb8a666da0413362dd978f
Author: Mathieu Bridon <bochecha(a)fedoraproject.org>
Date: Wed Aug 7 13:51:29 2013 +0800
Install docs in unversioned doc directory (#992144)
diff --git a/Makefile b/Makefile
index 2a88747..1656d72 100644
--- a/Makefile
+++ b/Makefile
@@ -28,10 +28,10 @@ install: man
$(INSTALL_PROGRAM) -D tools/livecd-iso-to-pxeboot.sh $(DESTDIR)/usr/bin/livecd-iso-to-pxeboot
$(INSTALL_PROGRAM) -D tools/edit-livecd $(DESTDIR)/usr/bin/edit-livecd
$(INSTALL_PROGRAM) -D tools/mkbiarch.py $(DESTDIR)/usr/bin/mkbiarch
- $(INSTALL_DATA) -D AUTHORS $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)/AUTHORS
- $(INSTALL_DATA) -D COPYING $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)/COPYING
- $(INSTALL_DATA) -D README $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)/README
- $(INSTALL_DATA) -D HACKING $(DESTDIR)/usr/share/doc/livecd-tools-$(VERSION)/HACKING
+ $(INSTALL_DATA) -D AUTHORS $(DESTDIR)/usr/share/doc/livecd-tools/AUTHORS
+ $(INSTALL_DATA) -D COPYING $(DESTDIR)/usr/share/doc/livecd-tools/COPYING
+ $(INSTALL_DATA) -D README $(DESTDIR)/usr/share/doc/livecd-tools/README
+ $(INSTALL_DATA) -D HACKING $(DESTDIR)/usr/share/doc/livecd-tools/HACKING
mkdir -p $(DESTDIR)/usr/share/livecd-tools/
mkdir -p $(DESTDIR)/$(PYTHONDIR)/imgcreate
$(INSTALL_PYTHON) -D imgcreate/*.py $(DESTDIR)/$(PYTHONDIR)/imgcreate/
10 years, 8 months