File langset.sh of Package kiwi-config-openSUSE
#!/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="/etc/langset/$Language""_$Country"
if ! test -f "$file"; then
file="/etc/langset/$Language"
fi
sed -e 's,: *,:,' "$file" | while read line; do
key=`echo $line | cut -d: -f1`
value=`echo $line | cut -d: -f2-`
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
sed -i -e "s#$key=\".*#$key=\"$value\"#" /etc/sysconfig/clock
done
echo "$Language""_$Country" > /var/lib/zypp/RequestedLocales
# create fdi file
/etc/X11/xdm/keytable4hal
exit 0 # no xorg.conf, see bnc#518918
exec 4>"/etc/X11/xorg.conf"
cat >&4 <<SECTION
# xorg.conf (X.Org X Window System server configuration file)
#
# This file was created as part of the live cd setup
SECTION
# allow setting by /proc/cmdline
DEVICE_DRIVER=""
DEVICE_BUSID=""
DEVICE_USE_FBDEV=""
QEMU_KVM=$(grep "QEMU Virtual CPU" /proc/cpuinfo || true)
if [ -n "$QEMU_KVM" ]; then
DEVICE_DRIVER="cirrus"
QEMU_VGA=$(lspci -v |grep "Technical Corp. Device 1111" || true)
if [ -n "$QEMU_VGA" ]; then
DEVICE_DRIVER="vesa"
fi
fi
VBOX_VIDEO=$(grep -e "^vbox " /proc/modules || true)
if [ -n "$VBOX_VIDEO" ]; then
DEVICE_DRIVER="vboxvideo"
fi
cat >&4 <<SECTION
Section "Device"
Identifier "Configured Video Device"
SECTION
if [ -n "$DEVICE_DRIVER" ]; then
printf "\tDriver\t\t\"$DEVICE_DRIVER\"\n" >&4
fi
PS3_FB=$(grep -i PS3 /proc/fb 2>/dev/null || true)
if [ -n "$PS3_FB" ]; then
printf "\tOption\t\t\"ShadowFB\"\t\t\"false\"\n" >&4
fi
if [ -n "$DEVICE_BUSID" ]; then
printf "\tBusID\t\t\"$DEVICE_BUSID\"\n" >&4
fi
if [ "$DEVICE_USE_FBDEV" = "true" ]; then
printf "\tOption\t\t\"UseFBDev\"\t\t\"$DEVICE_USE_FBDEV\"\n" >&4
fi
printf "EndSection\n" >&4
### MONITOR
cat >&4 <<SECTION
Section "Monitor"
Identifier "Configured Monitor"
SECTION
if [ -n "$QEMU_KVM" ]; then
printf "\tHorizSync\t30-70\n" >&4
printf "\tVertRefresh\t50-160\n" >&4
fi
cat >&4 <<SECTION
EndSection
SECTION
### SCREEN
cat >&4 <<SECTION
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
SECTION
if [ -n "$PS3_FB" ]; then
printf "\tDefaultFbBpp 32\n" >&4
fi
if [ -n "$QEMU_KVM" ]; then
cat >&4 <<SUBSECTION
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1280x800" "1152x768" "1024x768" "800x600" "640x480"
EndSubSection
SUBSECTION
fi
printf "EndSection\n" >&4
# Close file descriptor
exec 4<&-