|
#!/bin/sh
#
# Tue Nov 7 2000 Go Taniguchi <go@turbolinux.co.jp>
# Fri Feb 23 2001 Merlin Ma <merlin@turbolinux.com.cn>
#
function modinstall ;首先检测模块加载命令是否存在
{
/sbin/modprobe $1
if [ ! "$?" = "0" ]; then
echo Install driver $1 error.
exit 3
fi
}
if [ ! "$DISPLAY" = "" ] ; then ;如果是在X下运行此脚本则无效
echo Can not run unicon under X.
exit 1
fi
if [ ! "$UID" = "0" ] ; then ;只有root用户才能启动Unicon
echo Can not install unicon drivers with non root user.
exit 2
fi
if [ ! "$LC_ALL" = "" ] ; then
UNICONLANG=$LC_ALL
elif [ ! "$LANG" == "" ] ; then
UNICONLANG=$LANG
elif [ -e /etc/sysconfig/i18n ] ; then ;检测当前Locale
if grep -q GB18030 /etc/sysconfig/i18n ; then
UNICONLANG=GBK
elif grep -q GBK /etc/sysconfig/i18n ; then
UNICONLANG=GBK
elif grep -q GB /etc/sysconfig/i18n ; then
UNICONLANG=GB2312
elif grep -q TW /etc/sysconfig/i18n ; then
UNICONLANG=BIG5
elif grep -q HK /etc/sysconfig/i18n ; then
UNICONLANG=BIG5-HKSCS
elif grep -q ja /etc/sysconfig/i18n ; then
UNICONLANG=JP
elif grep -q ko /etc/sysconfig/i18n ; then
UNICONLANG=KR
else
UNICONLANG=GBK
fi
fi
if ! grep -q '[[:alnum:]]' /proc/fb ; then ;加载FrameBuffer模块
modinstall vga16fb
fi
modinstall unikey ;加载键盘映射驱动模块
loadunimap /usr/lib/unicon/direct.uni
case $UNICONLANG in
zh_CN.GB18030|GB18030)
modinstall encode-gbk ;加载GBK编码字体显示模块
unicon --gbk ;以GBK方式启动Unicon
;;
zh_CN.GB2312|GBK)
modinstall encode-gbk
unicon --gbk
;;
zh_CN.GBK|GBK)
modinstall encode-gbk
unicon --gbk
;;
zh_CN.GB2312|GB2312)
modinstall encode-gb
unicon --gb
;;
zh_TW.Big5|BIG5)
modinstall encode-big5
unicon --big5
;;
zh_HK|BIG5-HKSCS)
modinstall encode-big5
unicon --big5
;;
ja*|JP)
modinstall encode-jis
unicon --jis
;;
ko*|KR)
modinstall encode-kscm
unicon --kscm
;;
*)
modinstall encode-gbk
unicon --gbk
esac
if [ -f /var/lock/subsys/gpm ] ; then ;重新启动鼠标驱动GPM
/etc/rc.d/init.d/gpm restart 1>/dev/null 2>/dev/null
fi
exit 0 |
|