#!/bin/bash
#
#  NAME
#	gls-munge-grub - break the GRUB configuration file and reboot
#
#  USAGE
#	gls-munge-grub [--noreboot]
#
#  DESCRIPTION
#	This script breaks the GRUB configuration file and reboots.
#	This script is used in the assessment lab that teaches learners
#	how to edit the GRUB configuration at boot time.
#
#	The --noreboot option prevents the system from rebooting.
#
#  CHANGELOG
#	* Thu Dec 02 2010 George Hacker <ghacker@redhat.com>
#	- Fixed for RHEL6 (initrd -> initramfs)
#	* Mon Jul 05 2010 George Hacker <ghacker@redhat.com>
#	- Original code

PATH=/bin:/usr/bin:/sbin:/usr/sbin

sed -i -e '/initramfs-2\.6/s/\.img/-BROKEN.img/' /boot/grub/grub.conf

if [[ X"$1" = 'X--noreboot' ]]
then
	# do not reboot
	exit 0
else
	reboot
fi
