#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL

bterm=/usr/bin/bterm
uni_font=/opt/lib/unifont.bgf
kbdconf=/usr/bin/kbd-config

# We need to know ocsroot and functions in ocs-functions
. /opt/drbl/sbin/drbl-conf-functions
. /opt/drbl/sbin/ocs-functions
#
if [ -x "$bterm" -a -e "$uni_font" ] && ([ -e /dev/fb/0 ] || [ -e /dev/fb0 ]); then 
  if [ -z "$(localedef --list-archive | grep -iw "zh_TW.utf8")" ]; then
    localedef -f UTF-8 -i zh_TW zh_TW.UTF-8
  fi
  export LANG="zh_TW.UTF-8"
  export TERM=bterm
  set +e
  bterm -l $LANG -f $uni_font /opt/drbl/bin/kbdconf-bterm
  set -e
else
  export LANG=C
  $kbdconf
fi
