QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 852|回复: 5

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

[复制链接]
发表于 2005-7-22 17:28:18 | 显示全部楼层 |阅读模式
如何用脚本判断当前的系统是用lilo启动还是用grub启动的?
发表于 2005-7-23 09:06:39 | 显示全部楼层
可能看看有没有lilo.conf
没有的话可能是因为使用grub来启动
其他的 不清楚
那 看看mbr代码可能不同
回复

使用道具 举报

发表于 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
回复

使用道具 举报

发表于 2005-7-23 12:56:20 | 显示全部楼层
[quote:345102b1b9="twf_cc"]檢查是用那一個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[/quote]
兄弟,不同版本不一样。据我所知的linux版本都将grub.conf放在/boot/grub/下面,甚至根本就没有grub.conf这个文件
回复

使用道具 举报

 楼主| 发表于 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
回复

使用道具 举报

发表于 2005-7-23 18:59:38 | 显示全部楼层
[quote:6d200b6e30="yoic"]在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[/quote]
哈哈 我还猜对拉
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-10-1 23:30 , Processed in 0.055668 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表