X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=usr_sbin%2Fgrml-setkeyboard;h=ad2366c94ae4b67734935545bf6cba263c773bb3;hb=3b7f948896440f41092f14347b17ce114072c569;hp=04464de7db12dda7b1c38084b9e1cb86ee105057;hpb=ecb125a69f73cb71197a1db5c870a1263060d496;p=grml-scripts.git diff --git a/usr_sbin/grml-setkeyboard b/usr_sbin/grml-setkeyboard index 04464de..ad2366c 100755 --- a/usr_sbin/grml-setkeyboard +++ b/usr_sbin/grml-setkeyboard @@ -4,34 +4,27 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Sam Aug 05 11:40:27 CEST 2006 [mika] ################################################################################ -PN="$(basename $0)" +PN="$(basename "$0")" DIALOG=dialog CMDLINE=/proc/cmdline -if [ $UID != 0 ] ; then - echo Error: become root before starting $PN >& 2 - exit 100 -fi +# shellcheck disable=SC1091 +. /etc/grml/script-functions + +check4root || exit 1 setvalue(){ [ -n "$2" ] || return 1 # already present in conffile? - if grep -q ${1} $CONFFILE ; then - sed -i "s#^${1}.*#${1}=${2}#" $CONFFILE + if grep -q "${1}" "$CONFFILE" ; then + sed -i "s#^${1}.*#${1}=${2}#" "$CONFFILE" else - echo "$1=${2}" >> $CONFFILE + echo "$1=${2}" >> "$CONFFILE" fi } -# grml-small does not provide any further locales -# if grep -q small /etc/grml_version ; then -# $DIALOG --stdout --msgbox "Notice: grml-small -# does not provide a full language setup." 0 0 -# fi - # same for strings stringinstring(){ case "$2" in *$1*) return 0;; esac @@ -47,6 +40,7 @@ getbootparam(){ return 0 } +# shellcheck disable=SC1091 [ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard [ -n "$KEYTABLE" ] && DEFAULT_KEYBOARD="$KEYTABLE" @@ -57,15 +51,16 @@ if [ -z "$DEFAULT_KEYBOARD" ] ; then fi fi -LANGUAGE=$($DIALOG --stdout --title "$PN" --default-item $DEFAULT_KEYBOARD --radiolist \ +# shellcheck disable=SC1010 +{ +LANGUAGE=$(LANG=C $DIALOG --stdout --title "$PN" --default-item $DEFAULT_KEYBOARD --radiolist \ "Which keyboard layout do you want to use? Please notice that this will not really affect your currently running system. -If you want to change keyboard settings temporarly please use grml-lang instead. +If you want to change keyboard settings temporarily please use grml-lang instead. Configuration will be written to /etc/sysconfig/keyboard" 0 0 0 \ at austrian off \ - de german off \ be belgian off \ bg bulgarian off \ cf "french canadian" off \ @@ -73,15 +68,16 @@ Configuration will be written to /etc/sysconfig/keyboard" 0 0 0 \ cn chinese off \ cs czech off \ cz czech off \ - dk dansk off \ da da off \ + de german off \ + dk dansk off \ en "english [us] (default)" on \ es spanish off \ fi finnish off \ fr french off \ he hebrew off \ - il hebrew off \ ie irish off \ + il hebrew off \ it italian off \ ja japanese off \ nl dutch off \ @@ -93,6 +89,7 @@ Configuration will be written to /etc/sysconfig/keyboard" 0 0 0 \ tw "chinese (traditional)" off \ uk british off \ ) +} retval=$? case $retval in @@ -104,7 +101,8 @@ case $retval in esac # read in the file where all the $LANGUAGE stuff is defined - source /etc/grml/language-functions +# shellcheck disable=SC1091 +. /etc/grml/language-functions cat > /etc/sysconfig/keyboard <