#!/bin/sh

PATH=/bin:/usr/bin

if [ -f /etc/sysconfig/i18n ]; then
  . /etc/sysconfig/i18n
fi

case "$LANG" in
    *.utf8|*.UTF-8)
         if [ -x /bin/unicode_start ] && /sbin/consoletype fg ; then
      	    exec unicode_start $SYSFONT $SYSFONTACM
	 fi
	 ;;
esac

if [ -x /bin/consolechars -o -x /usr/bin/consolechars ]; then
  if [ -n "$SYSFONT" ]; then
    ARGS=$SYSFONT
    if [ -n "$UNIMAP" ]; then
       ARGS="$ARGS --sfm $UNIMAP"
    fi
    if [ -n "$SYSFONTACM" ]; then
       ARGS="$ARGS --acm $SYSFONTACM"
    fi
    consolechars -f $ARGS
  fi
elif [ -x /bin/setfont ]; then
  if [ -n "$UNIMAP" ]; then
    ARGS="-u $UNIMAP"
  fi
  if [ -n "$SYSFONTACM" ]; then
    if [ ! -f /lib/kbd/consoletrans/$SYSFONTACM_to_uni.trans ]; then
        SYSFONTACM=`echo $SYSFONTACM | sed "s|iso0|8859-|g;s|iso|8859-|g"`
    fi
    ARGS="$ARGS -m $SYSFONTACM"
  fi
  if [ -n "$SYSFONT" ]; then
    /bin/setfont $SYSFONT $ARGS
#  else
#    /bin/setfont
    echo -ne "\033(K" 2>/dev/null > /proc/$$/fd/0
  fi
fi

exit 0
