initscripts: fix up rc.d/locale.
--HG-- extra : convert_revision : b314bfe6ebff16cbeb797b16b3d26db1652e6727
This commit is contained in:
parent
e9a15758da
commit
8fcbfc42bb
1 changed files with 2 additions and 50 deletions
|
@ -19,7 +19,7 @@ locale_start()
|
|||
chmod 755 /etc/profile.d/locale.sh
|
||||
|
||||
# Check if requested locale was already created
|
||||
if ! $(localedef --list-archive|grep -q $LOCALE); then
|
||||
if $(locale -a|grep -q $LOCALE); then
|
||||
[ ! -d /usr/lib/locale ] && mkdir -p /usr/lib/locale
|
||||
echo -n "=> Building locale: $LOCALE... "
|
||||
localedef -i ${LOCALE%.*} -f UTF-8 ${LOCALE}
|
||||
|
@ -33,45 +33,12 @@ locale_start()
|
|||
show_rval
|
||||
|
||||
if echo "$LOCALE" | grep -qi utf ; then
|
||||
echo -n "=> Setting consoles to UTF-8 mode... "
|
||||
# UTF-8 consoles are default since 2.6.24 kernel
|
||||
# this code is needed not only for older kernels,
|
||||
# but also when user has set vt.default_utf8=0 but LOCALE
|
||||
# is *.UTF-8.
|
||||
for i in $(seq 0 63); do
|
||||
[ ! -e /dev/tty${i} ] && continue
|
||||
kbd_mode -u < /dev/tty${i}
|
||||
printf "\e%%G" > /dev/tty${i}
|
||||
done
|
||||
# the $CONSOLE check helps us avoid this when running scripts
|
||||
# from cron.
|
||||
cat >> /etc/profile.d/locale.sh <<_EOF
|
||||
if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then
|
||||
printf "\e%%G"
|
||||
fi
|
||||
_EOF
|
||||
show_rval
|
||||
if [ -n "$KEYMAP" ]; then
|
||||
echo -n "=> Loading keyboard map: $KEYMAP... "
|
||||
loadkeys -q -u $KEYMAP
|
||||
show_rval
|
||||
fi
|
||||
else
|
||||
echo -n "=> Setting consoles to legacy mode... "
|
||||
# make non-UTF-8 consoles work on 2.6.24 and newer kernels
|
||||
for i in $(seq 0 63); do
|
||||
[ ! -e /dev/tty${i} ] && continue
|
||||
kbd_mode -a < /dev/tty${i}
|
||||
printf "\e%%@" > /dev/tty${i}
|
||||
done
|
||||
# the $CONSOLE check helps us avoid this when running scripts
|
||||
# from cron.
|
||||
cat >> /etc/profile.d/locale.sh <<_EOF
|
||||
if [ -z "$CONSOLE" -a "$TERM" = "linux" -a -t 1 ]; then
|
||||
printf "\e%%@"
|
||||
fi
|
||||
_EOF
|
||||
show_rval
|
||||
if [ -n "$KEYMAP" ]; then
|
||||
echo -n "=> Loading keyboard map: $KEYMAP... "
|
||||
loadkeys -q $KEYMAP
|
||||
|
@ -95,22 +62,7 @@ _EOF
|
|||
>/dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed!"
|
||||
else
|
||||
for i in $(seq 0 63); do
|
||||
[ ! -e /dev/tty${i} ] && continue
|
||||
printf "\e(K" > /dev/tty${i}
|
||||
done
|
||||
# the $CONSOLE check helps us avoid this when running
|
||||
# scripts from cron.
|
||||
cat >> /etc/profile.d/locale.sh <<_EOF
|
||||
if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then
|
||||
printf "\e(K"
|
||||
fi
|
||||
_EOF
|
||||
echo "done."
|
||||
fi
|
||||
show_rval
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue