Skip to content

Commit

Permalink
grml-lang: use /etc/default/keyboard instead of /etc/sysconfig/keyboard
Browse files Browse the repository at this point in the history
For proper font handling we switched to usage of console-setup and
keyboard-configuration packages. We adjusted grml-live and
grml-autoconfig to use /etc/default/keyboard instead of
/etc/sysconfig/keyboard. To better handle this also within grml-lang
itself, switch to usage of /etc/default/keyboard.

FTR, this is not the final and bullet-proof solution yet, but meant to
be fix the main issues (e.g. booting with Grml defaults, then pressing
'd' for german keyboard within grml-quickconfig and then starting X via
'x' within grml-quickoconfig), using a minimal approach.

Initial work addressing grml/grml#115
  • Loading branch information
mika committed Dec 30, 2018
1 parent 4d6e684 commit 090cabd
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions usr_bin/grml-lang
Expand Up @@ -6,7 +6,7 @@
# License: This file is licensed under the GPL v2.
################################################################################

CONFFILE=/etc/sysconfig/keyboard
CONFFILE=/etc/default/keyboard
PN="$(basename $0)"

usage(){
Expand All @@ -16,36 +16,22 @@ usage(){

setvalue(){
[ -n "$2" ] || return 1
# already present in conffile?
if grep -q ${1} $CONFFILE 2>/dev/null ; then
sudo sed -i "s#^${1}.*#${1}=${2}#" $CONFFILE
else
echo "$1=${2}" | sudo tee -a $CONFFILE >/dev/null
fi
sudo sed -i "s#^${1}=.*#${1}=\"${2}\"#" "${CONFFILE}"
}

if [ $# -lt "1" ] ; then
usage
usage >&2
exit 1
fi

[ -d /etc/sysconfig ] || sudo mkdir /etc/sysconfig


LANGUAGE="$1"


. /etc/grml/language-functions

if [ ! -z "$KEYTABLE" ] ; then
setvalue KEYTABLE "$KEYTABLE"
fi

if [ ! -z "XKEYBOARD" ] ; then
setvalue XKEYBOARD $XKEYBOARD
if [ -n "$XKEYBOARD" ] ; then
setvalue XKBLAYOUT "$XKEYBOARD"
fi


if [ -z "$DISPLAY" ] ;then
if [ "$1" = "de" ] ; then
echo "Loading keymap for Germany..."
Expand Down Expand Up @@ -96,7 +82,11 @@ else
else
if [ "$1" = "de" ] ; then
echo "Loading keymap for Germany..."
[ -r $HOME/.Xmodmap.german ] && xmodmap $HOME/.Xmodmap.german || setxkbmap de
if [ -r "${HOME}"/.Xmodmap.german ] ; then
xmodmap "${HOME}"/.Xmodmap.german || setxkbmap de
else
setxkbmap de
fi
echo -e "\nDone."
elif [ "$1" = "at" ] ; then
echo "Loading keymap for Austria..."
Expand All @@ -120,7 +110,11 @@ else
echo -e "\nDone."
elif [ "$1" = "us" ] ; then
echo 'Loading keymap us...'
[ -r $HOME/.Xmodmap ] && xmodmap $HOME/.Xmodmap || setxkbmap us
if [ -r "${HOME}"/.Xmodmap ] ; then
xmodmap "${HOME}"/.Xmodmap || setxkbmap us
else
setxkbmap us
fi
echo -e "\nDone."
elif [ "$1" = "es" ] ; then
echo "Loading keymap es..."
Expand Down

0 comments on commit 090cabd

Please sign in to comment.