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: Sam Aug 05 11:40:27 CEST 2006 [mika]
8 ################################################################################
14 if [ $UID != 0 ] ; then
15 echo Error: become root before starting $PN >& 2
20 [ -n "$2" ] || return 1
21 # already present in conffile?
22 if grep -q ${1} $CONFFILE ; then
23 sed -i "s#^${1}.*#${1}=${2}#" $CONFFILE
25 echo "$1=${2}" >> $CONFFILE
29 # grml-small does not provide any further locales
30 # if grep -q small /etc/grml_version ; then
31 # $DIALOG --stdout --msgbox "Notice: grml-small
32 # does not provide a full language setup." 0 0
37 case "$2" in *$1*) return 0;; esac
41 # Reread boot command line; echo last parameter's argument or return false.
43 stringinstring " $1=" "$CMDLINE" || return 1
44 result="${CMDLINE##*$1=}"
45 result="${result%%[ ]*}"
50 [ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
52 [ -n "$KEYTABLE" ] && DEFAULT_KEYBOARD="$KEYTABLE"
53 if [ -z "$DEFAULT_KEYBOARD" ] ; then
54 DEFAULT_KEYBOARD="$(getbootparam lang 2>/dev/null)"
55 if [ -z "$DEFAULT_KEYBOARD" ] ; then
60 LANGUAGE=$($DIALOG --stdout --title "$PN" --default-item $DEFAULT_KEYBOARD --radiolist \
61 "Which keyboard layout do you want to use?
63 Please notice that this will not really affect your currently running system.
64 If you want to change keyboard settings temporarly please use grml-lang instead.
66 Configuration will be written to /etc/sysconfig/keyboard" 0 0 0 \
71 cf "french canadian" off \
78 en "english [us] (default)" on \
93 tw "chinese (traditional)" off \
102 (1) echo "Cancel pressed." ; exit 1 ;;
103 (255) echo "ESC pressed." ; exit 1 ;;
106 # read in the file where all the $LANGUAGE stuff is defined
107 source /etc/grml/language-functions
109 cat > /etc/sysconfig/keyboard <<EOF
110 # File generated by $PN on $(date)
112 XKEYBOARD="$XKEYBOARD"
113 KDEKEYBOARD="$KDEKEYBOARD"
114 KDEKEYBOARDS="$KDEKEYBOARD"
121 $DIALOG --stdout --msgbox "Writing keyboard settings ($KEYTABLE) to /etc/sysconfig/keyboard was successful." 0 0
124 $DIALOG --stdout --msgbox "Error writing settings for $KEYTABLE to /etc/sysconfig/keyboard." 0 0
128 ## END OF FILE #################################################################