Bootloader checker
·1 min
A bash code snippet that helps to check if the installed bootloader is Grub or LILO.
1#!/bin/bash
2
3A=`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 ":"`
4
5echo ; 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
6
7dd if=$A bs=512 count=1 2>&1 | grep LILO > /dev/null; if [ $? = 0 ] ; then echo -e "The installed bootloader is LILO.\n" ; fi