如何在debian下用lilo实现开机画面及自动更换画面 (By Simon Zhan)
如果能在linux下实现开机画面是不是一个很酷的功能,来吧!让我们做一个吧。
我用的是debian,因为可以很方便地通过apt-get实现在线软件升级。所以,现在我用debian做例子来讲解。
1.先删除原来的bootloader,apt-get --purge remove lilo(或者grub).
2.apt-get install lilo 这是安装最新版的lilo
3.运行liloconfig,按照提示配置一下。
4.打开/etc/lilo.conf, 检查一下boot=/dev/hda, 注意,这里的hda是你的linux所安装的硬盘,而不是分区如hda之类的。
5.lilo -M 这步是重写MBR.这一步很重要,否则不能真正地把bootloader写到MBR中。
6.lilo这一步是写配置文件到mbr中。
7.reboot.
下面是更换画面的代码,这下面的文件拷到/etc/init.d下,再到/etc/rcS.d下建一个名为S55bs_switch的符号链接,把文件修改成可执行的即可。
[code:1:1d1c2392e0]
#!/bin/bash
#
# bs_switchThis script can collect all the bmp files in the directory
#/usr/share/lilo/contrib and switch the bs_wwitch in sequence
#automatically under Debian Linux(Sarge version).
#It's written by Simon Zhan from Minqing County, China.
#
# Version@(#)bs_switch 0.8 11-May-2004 [email protected]
#
# notes:bs.lst contain all the files name in the
#/usr/share/lilo/contrib, and will delete one entry every
#rebooting the system.
#FILENAME is the file name which will replace the previous bmp.
#
# Usage:Copy this script into /etc/init.d, and make a symbolic link into
#/etc/rcS.d such as follow(notice the file's permission):
#ln -s /etc/init.d/bs_switch /etc/rcS.d/S55bs_switch
#and Enjoy!
cd /usr/share/lilo/contrib
while true
do
if [ ! -f /usr/share/lilo/contrib/bs.lst ];then
echo ""
echo "**************************************"
echo "* bs.lst not exist!, now creating... *"
echo "**************************************"
echo ""
sleep 3
ls /usr/share/lilo/contrib/*.bmp > /tmp/tmp.file
sed '/debian1.bmp/d' /tmp/tmp.file > /usr/share/lilo/contrib/bs.lst
fi
FILENAME=`sed -n '1p' /usr/share/lilo/contrib/bs.lst`
sed 1d /usr/share/lilo/contrib/bs.lst > /tmp/tmp.ls
if [ ! -s /tmp/tmp.ls ];then
echo ""
echo "**********************************************"
echo "* size of the bs.lst is zero, now delete it. *"
echo "**********************************************"
echo ""
sleep 3
rm /usr/share/lilo/contrib/bs.lst
else
mv /tmp/tmp.ls /usr/share/lilo/contrib/bs.lst
fi
if [ -f $FILENAME ];then
echo ""
echo "*******************"
echo "* Ok, I found it! *"
echo "*******************"
echo ""
sleep 3
break
fi
echo ""
echo "*****************************************************************"
echo "* OOPS!, I can't find the bmp file, I have to go to the next... *"
echo "*****************************************************************"
echo ""
sleep 3
done
cp $FILENAME debian1.bmp
lilo > /dev/null 2>&1
echo ""
echo "*********************************"
echo "* Bootscreen has been switched! *"
echo "*********************************"
echo ""
[/code:1:1d1c2392e0]
你也可以直接下载源代码
下载方法:你的系统要安装flashget或nettransport之类的下载工具,右击文件,即可下载,下载之后再把文件的.jpg扩展名去掉即可使用。
javascript:window.open(this.src);" style="CURSOR: pointer" onload="return imgzoom(this,550)"> | |||||||||
| |||||||||










javascript:window.open(this.src);" style="CURSOR: pointer" onload="return imgzoom(this,550)">