Release new version 2.13.0
[grml-scripts.git] / usr_sbin / grml-setkeyboard
index 4f12625..ad2366c 100755 (executable)
@@ -4,13 +4,13 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Mit Sep 05 19:06:41 CEST 2007 [mika]
 ################################################################################
 
-PN="$(basename $0)"
+PN="$(basename "$0")"
 DIALOG=dialog
 CMDLINE=/proc/cmdline
 
+# shellcheck disable=SC1091
 . /etc/grml/script-functions
 
 check4root || exit 1
@@ -18,10 +18,10 @@ 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
 }
 
@@ -40,6 +40,7 @@ getbootparam(){
   return 0
 }
 
+# shellcheck disable=SC1091
 [ -r /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
 
 [ -n "$KEYTABLE" ] && DEFAULT_KEYBOARD="$KEYTABLE"
@@ -50,15 +51,16 @@ if [ -z "$DEFAULT_KEYBOARD" ] ; then
   fi
 fi
 
+# 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 \
@@ -66,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 \
@@ -86,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
@@ -97,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 <<EOF
 # File generated by $PN on $(date)