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 ################################################################################
13 . /etc/grml/script-functions
18 [ -n "$2" ] || return 1
19 # already present in conffile?
20 if grep -q ${1} $CONFFILE ; then
21 sed -i "s#^${1}.*#${1}=${2}#" $CONFFILE
23 echo "$1=${2}" >> $CONFFILE
29 case "$2" in *$1*) return 0;; esac
33 # Reread boot command line; echo last parameter's argument or return false.
35 stringinstring " $1=" "$CMDLINE" || return 1
36 result="${CMDLINE##*$1=}"
37 result="${result%%[ ]*}"
42 [ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
44 [ -n "$KEYTABLE" ] && DEFAULT_KEYBOARD="$KEYTABLE"
45 if [ -z "$DEFAULT_KEYBOARD" ] ; then
46 DEFAULT_KEYBOARD="$(getbootparam lang 2>/dev/null)"
47 if [ -z "$DEFAULT_KEYBOARD" ] ; then
52 LANGUAGE=$(LANG=C $DIALOG --stdout --title "$PN" --default-item $DEFAULT_KEYBOARD --radiolist \
53 "Which keyboard layout do you want to use?
55 Please notice that this will not really affect your currently running system.
56 If you want to change keyboard settings temporarly please use grml-lang instead.
58 Configuration will be written to /etc/sysconfig/keyboard" 0 0 0 \
62 cf "french canadian" off \
70 en "english [us] (default)" on \
85 tw "chinese (traditional)" off \
94 (1) echo "Cancel pressed." ; exit 1 ;;
95 (255) echo "ESC pressed." ; exit 1 ;;
98 # read in the file where all the $LANGUAGE stuff is defined
99 . /etc/grml/language-functions
101 cat > /etc/sysconfig/keyboard <<EOF
102 # File generated by $PN on $(date)
104 XKEYBOARD="$XKEYBOARD"
105 KDEKEYBOARD="$KDEKEYBOARD"
106 KDEKEYBOARDS="$KDEKEYBOARD"
113 LANG=C $DIALOG --stdout --msgbox "Writing keyboard settings ($KEYTABLE) to /etc/sysconfig/keyboard was successful." 0 0
116 LANG=C $DIALOG --stdout --msgbox "Error writing settings for $KEYTABLE to /etc/sysconfig/keyboard." 0 0
120 ## END OF FILE #################################################################