#!/bin/sh
########################################################################
# Begin $rc_base/init.d/halt
#
# Description : Halt Script
#
# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
#
# Version     : 00.00
#
# Notes       :
#
########################################################################

. /etc/sysconfig/rc
. ${rc_functions}

case "${1}" in
	stop)
		sync && sync
		boot_mesg "Remount root readonly..."
		mount -f -o remount,ro / > /dev/null 2>&1
		evaluate_retval

		boot_mesg "Prepare for halt..."
		sleep 2

		#Disable all leds at shutdown
		for led in $(ls /sys/class/leds); do
			echo "none" > /sys/class/leds/$led/trigger
			echo "0"    > /sys/class/leds/$led/brightness
		done

		halt -d -f -i -p
		;;
	*)
		echo "Usage: {stop}"
		exit 1
		;;
esac

# End $rc_base/init.d/halt
