个人工具

“UbuntuHelp:BootText/zh”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
{{Copyedit translation|fromhttps://help.ubuntu.com/community/BootText}}
+
{{Copyedit translation|from=https://help.ubuntu.com/community/BootText}}
 
{{From|https://help.ubuntu.com/community/BootText}}
 
{{From|https://help.ubuntu.com/community/BootText}}
 
{{Translator|ekeng}}
 
{{Translator|ekeng}}

2007年5月18日 (五) 13:15的版本


本文不是提供启动图像也不是教您如何隐藏启动文字,只是让启动画面更好看而已.

提高分辨率

编辑 /boot/grub/menu.lst

gksudo gedit /boot/grub/menu.lst

vga=792 加到默认的启动菜单中. 例如:

titleUbuntu, kernel 2.6.10-5-k7 Default 
root(hd0,0)
kernel/vmlinuz root=/dev/hde6 ro quiet splash vga=792
initrd/initrd.img
savedefault
boot

改变"[ ok ]"的颜色

注:5.10 Breezy中无法使用. 解决方法点此. (ed. 28/12/2005) [译者注:我的Ubuntu 7.04 的init-functions文件的 log_end_msg () 函数不是如下所述,因此没有试验成功,望高手指点.]

我们让 "[ ok ]" 启动时变绿.

  • 编辑 /lib/lsb/init-functions
gksudo gedit /lib/lsb/init-functions
  • 找到log_end_msg () 函数, 通常在文件的底部,把GREEN=`$TPUT setaf 2` 添加RED=`$TPUT setaf 1`的下方.
  • echo "$UP$END[ ok ]" 改成 echo "$UP$END[ ${GREEN}ok${NORMAL} ]"

函数应像以下这样:

log_end_msg () {

[ -z "$1" ] && return 1

TPUT=/usr/bin/tput
EXPR=/usr/bin/expr
if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
COLS=`$TPUT cols`
if [ -n "$COLS" ]; then
COL=`$EXPR $COLS - 7`
else
COL=73
fi

UP=`$TPUT cuu1`
END=`$TPUT hpa $COL`
START=`$TPUT hpa 0`
RED=`$TPUT setaf 1`
GREEN=`$TPUT setaf 2`
NORMAL=`$TPUT op`
if [ $1 -eq 0 ]; then
echo "$UP$END[ ${GREEN}ok${NORMAL} ]"
else
echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
fi
else
if [ $1 -eq 0 ]; then
echo "   ...done."
else
echo "   ...fail!"
fi
fi
return $1
}

最终结果

重启,分辨率应该提高了, [ ok ] 的颜色应该变绿了.

参考: dudinatrix