yoic 发表于 2005-7-22 17:28:18

如何用脚本判断当前的系统是用lilo启动还是用grub启动的

如何用脚本判断当前的系统是用lilo启动还是用grub启动的?

BOoRFGOnZ 发表于 2005-7-23 09:06:39

可能看看有没有lilo.conf
没有的话可能是因为使用grub来启动
其他的 不清楚
那 看看mbr代码可能不同

twf_cc 发表于 2005-7-23 11:47:22

檢查是用那一個config 檔算是一種方法。
#! /bin/bash
if [ -e /etc/grub.conf ]; then
echo "grub is the boot manager."
elif [ -e /etc/lilo.conf ] ; then
echo "lilo is the boot manager."
else
echo "others."
fi

demonlj 发表于 2005-7-23 12:56:20

檢查是用那一個config 檔算是一種方法。
#! /bin/bash
if [ -e /etc/grub.conf ]; then
echo "grub is the boot manager."
elif [ -e /etc/lilo.conf ] ; then
echo "lilo is the boot manager."
else
echo "others."
fi
兄弟,不同版本不一样。据我所知的linux版本都将grub.conf放在/boot/grub/下面,甚至根本就没有grub.conf这个文件

yoic 发表于 2005-7-23 18:51:35

在linuxsir.org上有人回答了, 可以.
if dd if=/dev/hda bs=446 count=1 | strings | grep -q GRUB; then
echo "Your bootloader is GRUB"
elif dd if=/dev/hda bs=446 count=1 | strings | grep LILO; then
echo "Your bootloader is LILO"
else
echo "Unknown bootloader"
fi

BOoRFGOnZ 发表于 2005-7-23 18:59:38

在linuxsir.org上有人回答了, 可以.
if dd if=/dev/hda bs=446 count=1 | strings | grep -q GRUB; then
echo "Your bootloader is GRUB"
elif dd if=/dev/hda bs=446 count=1 | strings | grep LILO; then
echo "Your bootloader is LILO"
else
echo "Unknown bootloader"
fi
哈哈 我还猜对拉 :mrgreen:
页: [1]
查看完整版本: 如何用脚本判断当前的系统是用lilo启动还是用grub启动的