#!/bin/bash
#
# linux_logo	Hook to allow linux_logo to update issue and issue.net
#
# chkconfig: 2345 99 00
# description: Linux_logo puts up a greeting screen.

# Source the function library.
. /etc/init.d/functions

RETVAL=0

# See how we were called.
case "${1}" in
	start|restart|reload)
		if [ -x /usr/bin/linux_logo -a -f /etc/issue ] ; then
			if [ -f /etc/redhat-release ]; then
				DASHT="-t"
				RRELEASE=$(cat /etc/redhat-release)
			fi
			action "Updating issue: " echo $(/usr/bin/linux_logo -f ${DASHT} "${RRELEASE}" > /etc/issue)
			if [ -f /etc/issue.net ]; then
				action "Updationg issue.net: " echo $(cat /etc/issue > /etc/issue.net)
			fi
			RETVAL=${?}
			[ "${RETVAL}" = 0 ] && touch /var/lock/subsys/linux_logo
		fi
		;;
	stop)
		# ignore
		rm -f /var/lock/subsys/linux_logo
		;;
	*)
		echo "Usage: ${0} {start|stop|restart|reload}"
		RETVAL=1
esac

exit ${RETVAL}
