#! /bin/sh
### BEGIN INIT INFO
# Provides:          bubba-status
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Led status for Excito B3 platform.
### END INIT INFO

# Author: Charles Leclerc <leclerc.charles@gmail.com>

# Do NOT "set -e"

[ -x /usr/sbin/b3-set-led ] || exit 0

B3_RUNNING_COLOR=blue
B3_REBOOT_COLOR=purple

if test -f /etc/default/bubba-status; then
    . /etc/default/bubba-status
fi

. /lib/lsb/init-functions

case "$1" in
	start|restart|force-reload)
		log_begin_msg "Setting LED status (running)"
		/usr/sbin/b3-set-led $B3_RUNNING_COLOR
		log_end_msg 0
		;;
	stop)
		log_begin_msg "Setting LED status (reboot/halt)"
		/usr/sbin/b3-set-led $B3_REBOOT_COLOR
		log_end_msg 0
		;;
	*)
		echo "Usage: /etc/init.d/bubba-status {start|stop|restart|force-reload}" >&2
		exit 1
		;;
esac

exit 0
