#! /bin/sh
# rc.local_shutdown :	This file is executed by init when it goes into runlevel
#		0 (halt) or runlevel 6 (reboot). 
# Copyright 2016  Jean-Philippe Guillemin, all rights reserved.
#


# Update lilo in case of new kernel
if [ ! -d /sys/firmware/efi ]; then  
	BOOTDEV="$( sed -n 's|boot *= *\(.*\)$|\1|p' /etc/lilo.conf )"
	if dd if=$BOOTDEV bs=512 count=1 2>/dev/null | grep -b -q LILO ; then
		[ ! "$(/bin/md5sum /boot/vmlinuz)" == "$(cat /boot/last_vmlinuz_md5)" ] && /sbin/lilo
		/bin/md5sum /boot/vmlinuz > /boot/last_vmlinuz_md5
	fi
fi
