installer.kmdr: fixes for language and locale settings; drop support; drop support for /etc/sysconfig/{i18n,keyboard}

This commit is contained in:
Silvan Calarco 2014-04-05 18:22:14 +02:00
parent 460230742e
commit 10067eb5b0

View File

@ -953,8 +953,7 @@ if [ -r ~/.kde4/share/config/kdeglobals ]; then
*) LANGUAGE="${Language}" ;;
esac
LANGUAGE=${LANGUAGE:0:5}.UTF-8
sed -i "s|LANG=.*|LANG=$LANGUAGE|" /etc/sysconfig/i18n
sed -i "s|LANG=.*|LANG=$LANGUAGE|" /etc/locale.conf
sudo sed -i "s|LANG=.*|LANG=$LANGUAGE|" /etc/locale.conf
fi
fi
@execEnd
@ -977,8 +976,7 @@ fi
</property>
<property name="associations" stdset="0">
<stringlist>
<string>. /etc/sysconfig/i18n
LANGUAGE="$LANG"
<string>LANGUAGE="$LANG"
if [ -r ~/.kde4/share/config/kdeglobals ]; then
eval `grep -i Country ~/.kde4/share/config/kdeglobals`
# find country definition in selected language
@ -1000,6 +998,7 @@ fi
case ${LANGUAGE:0:5} in
en_*) LANGUAGE="English (${LANGUAGE:3:2})" ;;
es_*) LANGUAGE="Español" ;;
fr_*) LANGUAGE="Français" ;;
it_IT) LANGUAGE="Italiano" ;;
it_CH) LANGUAGE="Italiano (CH)" ;;
*) LANGUAGE="${LANGUAGE:0:2}" ;;
@ -1139,17 +1138,14 @@ dcop @dcopid KommanderIf setText countrylabel $"$COUNTRY"
<stringlist>
<string>LAYOUT_CURR="@kblayout_box.item(@kblayout_box.currentItem)"
MODEL_CURR="@kbgeometry_box.item(@kbgeometry_box.currentItem)"
LAYOUT=`awk '/! layout/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep "$LAYOUT_CURR" | awk '{print $1}'`
MODEL=`awk '/! model/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep "$MODEL_CURR" | awk '{print $1}'`
LAYOUT=`awk '/! layout/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep " $LAYOUT_CURR$" | awk '{print $1}'`
MODEL=`awk '/! model/,/$^/' /usr/share/X11/xkb/rules/base.lst | grep " $MODEL_CURR$" | awk '{print $1}'`
setxkbmap -layout $LAYOUT -model $MODEL
sed -i "s|\(KEYMAP=\).*|\1$LAYOUT.map|" /etc/sysconfig/keyboard
sed -i "s|\(XKB_LAYOUT=\).*|\1$LAYOUT|" /etc/sysconfig/keyboard
sed -i "s|\(XKB_MODEL=\).*|\1$MODEL|" /etc/sysconfig/keyboard
sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf
sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf
sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf.d/10-keyboard.conf
sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf.d/10-keyboard.conf
sed -i "s|\(KEYMAP=\).*|\1$LAYOUT|" /etc/vconsole.conf
sudo sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf
sudo sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf
sudo sed -i "s|\(\"XkbLayout\"\).*|\1 \"$LAYOUT\"|" /etc/X11/xorg.conf.d/10-keyboard.conf
sudo sed -i "s|\(\"XkbModel\"\).*|\1 \"$MODEL\"|" /etc/X11/xorg.conf.d/10-keyboard.conf
sudo sed -i "s|\(KEYMAP=\).*|\1$LAYOUT|" /etc/vconsole.conf
</string>
</stringlist>
</property>
@ -1170,12 +1166,12 @@ sed -i "s|\(KEYMAP=\).*|\1$LAYOUT|" /etc/vconsole.conf
<stringlist>
<string>@testEdit.setSelection(@testEdit.text)
dcop @dcopid KommanderIf setBusyCursor true
. /etc/sysconfig/keyboard
if [ ! "$XKB_LAYOUT" ]; then
eval `grep "^LayoutList=" ~/.kde4/share/config/kxkbrc`
[ "$LayoutList" ] &amp;&amp; \
XKB_LAYOUT="${LayoutList/,*/}" || \
XKB_LAYOUT="us"
XKB_LAYOUT=`setxkbmap -print | awk -F"+" '/xkb_symbols/ { print $2}'`
[ "$XKB_LAYOUT" ] || XKB_LAYOUT="us"
fi
awk '/! layout/,/$^/' /usr/share/X11/xkb/rules/base.lst | sort -k2 | \
while read id desc; do
@ -1185,6 +1181,13 @@ while read id desc; do
fi
done
if [ ! "$XKB_MODEL" ]; then
eval `grep "^Model=" ~/.kde4/share/config/kxkbrc`
[ "$Model" ] &amp;&amp; \
XKB_MODEL="${Model/,*/}" || \
XKB_MODEL=`setxkbmap -print | grep xkb_geometry | sed "s|.*(\(.*\)).*|\1|"`
[ "$XKB_MODEL" ] || XKB_MODEL="pc105"
fi
awk '/! model/,/$^/' /usr/share/X11/xkb/rules/base.lst | sort -k2 | \
while read id desc; do
if [ "$id" != "!" -a "$id" != "" ]; then