GFXBOOT菜单中文显示修改脚本

| |
| 不指定 October 12, 2008 @ 18:40, Robin Hoo
很喜欢OpenSUSE的图形化GRUB启动菜单,但是在使用的时候发现,菜单内容不能使中文。搜索后发现图形菜单可以自己修改的,并发现起重新组装的部分可以利用来生成其中关键文件16x16.fnt文件。动手写了个小脚本,保存一下,供以后修改。目前在OpenSUSE上修改成功。Ubuntu下面没有测试过。主要是不知道gfxboot-font和keymapschar文件是否存在。

      
Bash语言: GFXBOOT菜单中文显示修改脚本
      
01 #!/bin/bash
02 echo "Please wait for searching the gfxboot-font & keymapchars command available or not ..."
03 ##Define gfxmenu used message
04 MESSAGE=/boot/message
05 ##Define the gfxboot-font command localtion
06 #You can manual specify the location
07 GFXBOOT_FONT=`find / -name gfxboot-font -type f 2>/dev/null |head -n 1`
08 ##Define keymapschars command location
09 KEYMAPCHARS=`find / -name keymapchars -type f 2>/dev/null |head -n 1`
10 ##Define keymaps directory location
11 #KEYMAPS=/usr/share/gfxboot/themes/openSUSE/keymaps
12 KEYMAPS=`find / -name keymap.cs_CZ.inc -type f 2>/dev/null |head -n 1`
13 KEYMAPS=${KEYMAPS%/keymap.cs_CZ.inc}
14 ##Define temp fold location
15 TMP_FOLD=message
16 ##Define langauge need font name
17 TTFFont=ukai
18 ##Define langauge will show on the boot menu
19 LANGUAGE=简体中文
20 ##Define language ID will add into languages
21 LANG_ID=zh
22 ##Define default boot menu language ID
23 DEF_LANG=zh_CN
24 mkdir $TMP_FOLD
25 cd $TMP_FOLD
26 cat $MESSAGE |cpio -i
27 echo $DEF_LANG >lang
28 echo "File lang is ready!"
29 if [ -e translations.$LANG_ID ]
30 then
31     echo "File translations.$LANG_ID is ready!"
32 else
33     echo "Sorry the translation file is not there! Quiting..."
34     exit
35 fi
36 if grep -q  $LANG_ID languages
37 then
38     echo "File languages is ready!"
39 else
40     echo $LANG_ID > tmp.txt
41     cat tmp.txt languages >languages1
42     cp -f languages1 languages
43     rm -f languages1
44     echo "File languages is ready!"
45 fi
46 cat *.tr translations.* pabout.txt /boot/grub/menu.lst >tmp.txt
47 echo $LANGUAGE>> tmp.txt
48 $GFXBOOT_FONT -v -l 18
49     -c ISO-8859-15 -c ISO-8859-2 -c koi8 -c utf8 -r
50     `$KEYMAPCHARS $KEYMAPS/keymap.*.inc`
51     -t tmp.txt
52     -t languages
53     -f NachlieliCLM-Bold:size=14:c=0x590-0x5ff
54     -f KacstOne:size=14:c=0x600-0x6ff,0xfe70-0xfefc:dy=2
55     -f MuktiNarrow:size=18:c=0x0981-0x09fa:bold=1
56     -f lohit_hi:size=18:c=0x0901-0x0970:bold=1
57     -f lohit_pa:size=19:c=0x0a01-0x0a74:bold=1:autohint=1
58     -f lohit_gu:size=18:c=0x0a81-0x0af1:bold=1
59     -f TSCu_Paranar:size=18:c=0x0b82-0x0bfa:dy=2:bold=1
60     -f lklug:size=17:c=0x0d82-0x0df4:bold=1:dy=1
61     -f Loma:size=17:c=0x0e01-0x0e7f:bold=0:dy=-2
62     -f KhmerOS_sys:size=16:c=0x1780-0x17f9:dy=-2
63     -f DejaVuSans-Bold:size=14
64     -f $TTFFont:size=17:nobitmap=1:autohint=1
65     -f gulim:size=17:bold=1:nobitmap=1:autohint=1
66     16x16.fnt >16x16.fnt.log
67 echo "File 16x16.fnt is ready!"
68 rm -f tmp.txt
69 mv 16x16.fnt.log ../
70 echo "Making backup..."
71 cp $MESSAGE $MESSAGE.bck
72 ls . |cpio -o > $MESSAGE
73 echo "Please clear the tmp directory message!"
    


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

验证码 不区分大小写