live-langset-data/langset.sh
Dominique Leuenberger 4426928bff Accepting request 526159 from openSUSE:Factory:Live
- Initial package, split from kiwi-config-openSUSE
- Fix target path handling in getcountrydata.rb
- Try to load the distro-specific console data file first

OBS-URL: https://build.opensuse.org/request/show/526159
OBS-URL: https://build.opensuse.org/package/show/system:install:head/live-langset-data?expand=0&rev=1
2017-09-15 09:39:27 +00:00

52 lines
1.2 KiB
Bash

#!/bin/sh
lang=en_US
for o in $(cat /proc/cmdline); do
case $o in
lang=*)
eval $o
;;
esac
done
# we need the _NOT so there is always a field 2
Country=$(echo "$lang"_NOT | cut -d_ -f2)
Language=$(echo "$lang" | cut -d_ -f1)
file="/usr/share/langset/$Language""_$Country"
if ! test -f "$file"; then
file="/usr/share/langset/$Language"
fi
layout=
model=
variant=
options=
sed -e 's,: *,:,' "$file" | while read line; do
key=`echo $line | cut -d: -f1`
value=`echo $line | cut -d: -f2-`
if [ "$key" = "XkbLayout" ]; then
layout="$value"
elif [ "$key" = "XkbModel" ]; then
model="$value"
elif [ "$key" = "XkbVariant" ]; then
variant="$value"
elif [ "$key" = "XkbOptions" ]; then
options="$value"
fi
sed -i -e "s#$key=\".*#$key=\"$value\"#" /etc/sysconfig/language
sed -i -e "s#$key=\".*#$key=\"$value\"#" /etc/sysconfig/keyboard
sed -i -e "s#$key=\".*#$key=\"$value\"#" /etc/sysconfig/console
if [ -n "$layout" ] && [ -n "$model" ] && [ -n "$variant" ] && [ -n "$options" ]; then
localectl set-x11-keymap "$layout" "$model" "$variant" "$options"
fi
done
echo "$Language""_$Country" > /var/lib/zypp/RequestedLocales
# Apply the settings
systemctl restart systemd-vconsole-setup