summaryrefslogtreecommitdiff
path: root/config/chroot_local-includes
diff options
context:
space:
mode:
authorAndreas Loibl <andreas@andreas-loibl.de>2012-10-15 06:42:26 +0200
committerAndreas Loibl <andreas@andreas-loibl.de>2012-10-15 06:42:26 +0200
commit29bf6f4a39e8066ec252cbdbe7652491c375deee (patch)
tree4825be127c785dd401f21889d09a981007c90887 /config/chroot_local-includes
parent549d297208d513385b2af94992661d3adbca8766 (diff)
downloadkanotix-29bf6f4a39e8066ec252cbdbe7652491c375deee.zip
kanotix-29bf6f4a39e8066ec252cbdbe7652491c375deee.tar.gz
added live-config script to update kxkbrc according to "keyboard-layouts=xy" cmdline option
Diffstat (limited to 'config/chroot_local-includes')
-rwxr-xr-xconfig/chroot_local-includes/lib/live/config/800-kde-keyboard-layout60
1 files changed, 60 insertions, 0 deletions
diff --git a/config/chroot_local-includes/lib/live/config/800-kde-keyboard-layout b/config/chroot_local-includes/lib/live/config/800-kde-keyboard-layout
new file mode 100755
index 0000000..62e3927
--- /dev/null
+++ b/config/chroot_local-includes/lib/live/config/800-kde-keyboard-layout
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+KdeKeyboardLayout ()
+{
+ KXKBRC=/home/${LIVE_USERNAME}/.kde/share/config/kxkbrc
+
+ # Checking if package is already configured
+ if [ -e /var/lib/live/config/kdekeyboardlayout ] || \
+ [ ! -e ${KXKBRC} ]
+ then
+ return
+ fi
+
+ echo -n " kdekeyboardlayout"
+
+ for _PARAMETER in ${_CMDLINE}
+ do
+ case "${_PARAMETER}" in
+ live-config.keyboard-layouts=*|keyboard-layouts=*)
+ LIVE_KEYBOARD_LAYOUTS="${_PARAMETER#*keyboard-layouts=}"
+ ;;
+
+ live-config.keyboard-model=*|keyboard-model=*)
+ LIVE_KEYBOARD_MODEL="${_PARAMETER#*keyboard-model=}"
+ ;;
+
+ live-config.keyboard-options=*|keyboard-options=*)
+ LIVE_KEYBOARD_OPTIONS="${_PARAMETER#*keyboard-options=}"
+ ;;
+
+ live-config.keyboard-variants=*|keyboard-variants=*)
+ LIVE_KEYBOARD_VARIANTS="${_PARAMETER#*keyboard-variants=}"
+ ;;
+ esac
+ done
+
+ if [ -z "$LIVE_KEYBOARD_LAYOUTS" ]
+ then
+ LIVE_KEYBOARD_LAYOUTS=us
+ fi
+
+ Configure_kdekeyboardlayout
+}
+
+Configure_kdekeyboardlayout ()
+{
+ COL="$(awk -F'=' '{if($1=="DisplayNames"){gsub(",","\n",$2); print $2}}' "$KXKBRC" | grep -nw "$LIVE_KEYBOARD_LAYOUTS" | cut -d: -f1)"
+ if [ "$COL" = 1 ]; then
+ true # nothing to do, already first position
+ elif [ "$COL" ]; then
+ sed -i 's/^\(DisplayNames\|LayoutList\)=\(.*\),\('$LIVE_KEYBOARD_LAYOUTS'[^,]*\)/\1=\3,\2,/; s/^\(DisplayNames\|LayoutList\)=\([^,]*,.*\)'$LIVE_KEYBOARD_LAYOUTS'[^,]*/\1=\2,/; s/,,*/,/g; s/,$//' "$KXKBRC"
+ else
+ sed -i 's/^\(DisplayNames\|LayoutList\)=/\1='$LIVE_KEYBOARD_LAYOUTS',/; s/,$//' "$KXKBRC"
+ fi
+
+ # Creating state file
+ touch /var/lib/live/config/kdekeyboardlayout
+}
+
+KdeKeyboardLayout