2 # Filename: grml-setkeyboard
3 # Purpose: set keyboard layout system-wide on grml system
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Mit Sep 05 19:06:41 CEST 2007 [mika]
8 ################################################################################
14 . /etc/grml/script-functions
19 [ -n "$2" ] || return 1
20 # already present in conffile?
21 if grep -q ${1} $CONFFILE ; then
22 sed -i "s#^${1}.*#${1}=${2}#" $CONFFILE
24 echo "$1=${2}" >> $CONFFILE
30 case "$2" in *$1*) return 0;; esac
34 # Reread boot command line; echo last parameter's argument or return false.
36 stringinstring " $1=" "$CMDLINE" || return 1
37 result="${CMDLINE##*$1=}"
38 result="${result%%[ ]*}"
43 [ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
45 [ -n "$KEYTABLE" ] && DEFAULT_KEYBOARD="$KEYTABLE"
46 if [ -z "$DEFAULT_KEYBOARD" ] ; then
47 DEFAULT_KEYBOARD="$(getbootparam lang 2>/dev/null)"
48 if [ -z "$DEFAULT_KEYBOARD" ] ; then
53 LANGUAGE=$(LANG=C $DIALOG --stdout --title "$PN" --default-item $DEFAULT_KEYBOARD --radiolist \
54 "Which keyboard layout do you want to use?
56 Please notice that this will not really affect your currently running system.
57 If you want to change keyboard settings temporarly please use grml-lang instead.
59 Configuration will be written to /etc/sysconfig/keyboard" 0 0 0 \
63 cf "french canadian" off \
71 en "english [us] (default)" on \
86 tw "chinese (traditional)" off \
95 (1) echo "Cancel pressed." ; exit 1 ;;
96 (255) echo "ESC pressed." ; exit 1 ;;
99 # read in the file where all the $LANGUAGE stuff is defined
100 source /etc/grml/language-functions
102 cat > /etc/sysconfig/keyboard <<EOF
103 # File generated by $PN on $(date)
105 XKEYBOARD="$XKEYBOARD"
106 KDEKEYBOARD="$KDEKEYBOARD"
107 KDEKEYBOARDS="$KDEKEYBOARD"
114 LANG=C $DIALOG --stdout --msgbox "Writing keyboard settings ($KEYTABLE) to /etc/sysconfig/keyboard was successful." 0 0
117 LANG=C $DIALOG --stdout --msgbox "Error writing settings for $KEYTABLE to /etc/sysconfig/keyboard." 0 0
121 ## END OF FILE #################################################################