Ubuntu gfxmenu中文显示的脚本

| |
| 不指定 October 28, 2008 @ 13:32, Robin Hoo
更新了在Ubuntu上修改gfxmenu中文显示的脚本。有空的时候,将它改成Windows下可以运行的执行文件。


      
Bash语言: gfxmenu中文显示脚本
      
01 #!/bin/bash
02 DEBUG=1
03 START_DIR=`pwd`
04 ##定义图形启动包的位置
05 MESSAGE=/boot/message
06 ##定义字形生成程序位置
07 MKBLFONT=mkblfont
08 ##定义menu.lst位置
09 MENU_LST=/boot/grub/menu.lst
10 ##定义键盘映射程序位置
11 KEYMAPCHARS=/usr/share/gfxboot/bin/keymapchars
12 ##定义键盘映射表位置
13 KEYTABLES=/usr/share/gfxboot-theme-ubuntu/keytables.inc
14 ##定义临时文件位置
15 TMP_FOLD=message
16 ##定义字形所用字体
17 TTFFont=simli
18 ##定义字体目录
19 TTFPath=/usr/share/fonts/truetype/microsoft
20 ##定义界面语言
21 LANGUAGE=简体中文
22 ##定义语言ID
23 LANG_ID=zh
24 ##定义默认启动语言
25 DEF_LANG=zh_CN
26 debug_msg()
27 {
28     [ $DEBUG == 1 ] && echo "[`date +"%F %T"`] $@" >&2
29 }
30
31 install_pkg()
32 {
33     local PKG=`sudo dpkg-query -W --showformat='${Package} ' |grep $1`
34     if [ -z $PKG ]; then
35         sudo aptitude install $1 -y
36         debug_msg "安装软件包 $1"
37     else
38         debug_msg "软件包 $1 已安装"
39     fi
40 }
41 install_pkg gfxboot-theme-ubuntu
42 echo $DEF_LANG >lang
43 mkdir $TMP_FOLD 2>/dev/null
44 cd $TMP_FOLD
45 #ls -l $MESSAGE #>/dev/null 2>&1
46 if [ -e $MESSAGE ]; then
47     cat $MESSAGE |cpio -i
48 else
49     echo "抱歉没发现要修改的$MESSAGE"
50     exit
51 fi
52 echo $DEF_LANG >lang
53 if [ -e translations.$LANG_ID ]
54 then
55      echo "发现${LANGUAGE}翻译文件!"
56 else
57     echo "没有${LANGUAGE}的翻译文件,退出!"
58     exit
59 fi
60 if grep -q  $LANG_ID languages
61 then
62    echo "文件languages含有${LANGUAGE}的ID!"
63 else
64     echo $LANG_ID > tmp.txt
65     cat tmp.txt languages >languages1
66     mv -f languages1 languages
67     echo "文件languages含有${LANGUAGE}的ID!"
68 fi
69 cat *.tr translations.* $MENU_LST >tmp.txt
70 echo $LANGUAGE>> tmp.txt
71 set -x
72 $MKBLFONT -v -l 18 -p /usr/share/fonts/X11/misc
73     -c ISO-8859-15 -c ISO-8859-2 -c koi8-r
74     `$KEYMAPCHARS $KEYTABLES`
75     -t tmp.txt
76     -p $TTFPath
77     -f $TTFFont:prop=2:space_width=4:size=17:nobitmap=1:autohint=1
78     16x16.fnt >16x16.fnt.log
79 set +x
80 rm -f tmp.txt
81 mv 16x16.fnt.log $START_DIR
82 echo "备份以前文件"
83 mv $MESSAGE $MESSAGE.bck
84 ls . |cpio -o > $MESSAGE
85 cd $START_DIR
86 rm -rf $TMP_FOLD
    


文章来自: 本站原创
0 comment(s)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 不区分大小写