console: support multilanguage installation by post-configuring /etc/vconsole.conf and /etc/locale.conf
This commit is contained in:
parent
381aed1e7b
commit
7c2ebe3873
@ -1,35 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# console - virtual consoles plugin for postplug
|
# console - virtual consoles plugin for postplug
|
||||||
# Copyright (c) 2012-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (c) 2012-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
|
||||||
# systemd: no need to manage inittab
|
grep "^KEYMAP=" /etc/vconsole.conf >/dev/null || {
|
||||||
[ -d /run/systemd ] && exit 0
|
KEYMAP="${LANG:0:2}"
|
||||||
|
echo "KEYMAP=$KEYMAP" >> /etc/vconsole.conf
|
||||||
|
}
|
||||||
|
|
||||||
if [ $UID != 0 ]; then
|
grep "^LANG=C$" /etc/locale.conf >/dev/null && \
|
||||||
echo "$0: must be superuser." >&2
|
sed -i "/^LANG=$/d" /etc/locale.conf
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
TTYs=`grep "^[0-9]:" /etc/inittab | sed "s|.*\(tty[^[:space:]]*\).*|\1|"`
|
grep "^LANG=" /etc/locale.conf >/dev/null || \
|
||||||
|
echo "LANG=$LANG" >> /etc/locale.conf
|
||||||
for t in $TTYs; do
|
|
||||||
case $t in
|
|
||||||
tty[0-9]*)
|
|
||||||
[ -e /dev/tty ] && continue;
|
|
||||||
sed -i "s|\([0-9].*$t .*\)|#\1|" /etc/inittab
|
|
||||||
TTYchanged=1
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
tty*)
|
|
||||||
if [ ! -e /dev/$t -o "`setserial /dev/$t | grep 'UART: unknown' 2>/dev/null`" ]; then
|
|
||||||
sed -i "s|\([0-9].*$t .*\)|#\1|" /etc/inittab
|
|
||||||
TTYchanged=1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[ "$TTYchanged" ] && telinit q
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user