Package: console-setup Version: 1.28 Severity: normal Blocks: 508244 Hi,
on upgrade from lenny to squeeze, console-setup will get installed as dependency of xserver-xorg, and the keyboard layout for X will be read from /etc/default/console-setup (unless for some reason that plan doesn't work out, but so far it seems ok). In order to make the upgrade path work, and avoid prompting users or unexpectedly changing their X kbd layout, console-setup will thus need to read xorg.conf, with something like the following patch. This is only lightly tested at the moment (thus no patch tag), but I'm filing this early in case people have comments already :) Basically, I scan xorg.conf for the first InputDevice section with an XkbLayout option, and use the options from that section. This is not quite complete (if you have multiple InputDevice sections with different layouts, all but the first will be ignored), but should cover most cases. One question though, it looks like it's not possible to set multiple layouts using console-setup's debconf interface? Is there another way to preserve this kind of settings when they're set that way in xorg.conf? Cheers, Julien diff --git a/debian/config.proto b/debian/config.proto index 0d9c2fc..891cd05 100644 --- a/debian/config.proto +++ b/debian/config.proto @@ -1051,14 +1051,64 @@ esac ####################################################################### +# Get the layout from xorg.conf if available, and lower the priority of +# the Debconf question to low +if [ -f /etc/X11/xorg.conf ]; then + awk_expr=' +BEGIN { state=0 } +{ + if (state == 0) { + if (tolower($1) == "section" && tolower($2) == "\"inputdevice\"") + state = 1 + } + if (state == 1) { + if (tolower($1) == "option") { + if (tolower($2) == "\"xkbmodel\"") + xkbmodel = $3 + if (tolower($2) == "\"xkblayout\"") + xkblayout = $3 + if (tolower($2) == "\"xkbvariant\"") + xkbvariant = $3 + if (tolower($2) == "\"xkboptions\"") + xkboptions = $3 + } + if (tolower($1) == "endsection") { + if (xkblayout) { + print "XKBLAYOUT=" xkblayout + if (xkbmodel) print "XKBMODEL=" xkbmodel + if (xkbvariant) print "XKBVARIANT=" xkbvariant + if (xkboptions) print "XKBOPTIONS=" xkboptions + exit + } + state = 0 + xkbmodel = "" + xkblayout = "" + xkbvariant = "" + xkboptions = "" + } + } +} +' + eval $(awk "$awk_expr" < /etc/X11/xorg.conf) + + got_xkboptions=yes + model_priority=low + layout_priority=low + if [ "$XKBMODEL" ]; then + default_model="$XKBMODEL" + fi + if [ "$XKBLAYOUT" ]; then + default_layout="${XKBLAYOUT%,*}" + fi + default_variant="${XKBVARIANT%,*}" + +elif db_get debian-installer/keymap && [ "$RET" ]; then # Use the value of debian-installer/keymap to get better default # layout. Lower the priority of the Debconf question to medium. # This is a desperation measure, but required for migration from # pre-console-setup systems without X installed. We just have to copy # the guesswork formerly done by xserver-xorg.config. - -if db_get debian-installer/keymap && [ "$RET" ]; then di_keymap="${RET##mac-usb-}" di_keymap="${di_keymap%%-latin1}" -- To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org