Bootloader checker


A bash code snippet that helps to check if the installed bootloader is Grub or LILO.

#!/bin/bash

A=`mount | awk '{print $1}' | grep -n /dev/ | grep "1:" | cut -f2 -d ":" | cut -c 1-8`
B=`mount | awk '{print $1}' | grep -n /dev/ | grep "1:" | cut -f2 -d ":"`

echo ; echo -e " / mounted on $B \n";
dd if=$A bs=512 count=1 2>&1 | grep GRUB > /dev/null;
if [ $? = 0 ] ; then echo -e "The installed bootloader is GRUB.\n" ; fi

dd if=$A bs=512 count=1 2>&1 | grep LILO > /dev/null;
if [ $? = 0 ] ; then echo -e "The installed bootloader is LILO.\n" ; fi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s