#!/sbin/runscript

depend() {
	# run after local so that the boot time splash image
	# is visible for as long as possible
	after local
}

start() {
	# Only do this if the kernel has support
	if [ -f /proc/splash ]
	then
		ebegin "Setting Console frame buffer images"

		# switch to a usable image on all consoles
		for TTY in `seq 0 5`
		do
			/usr/bin/splash -s -u $TTY /usr/share/bootsplash/consolesplash.cfg
		done

		eend $? "Failed to set frame buffer console images"
	fi
}

stop() {
	# Stop doesn't really stop, it actually changes the image
	# on vt1 back to the bootsplash image.

	# Only do this if the kernel has support
	if [ -f /proc/splash ]
	then
		ebegin "Setting Console frame buffer images"
		
		# Put bootsplash image up
		/usr/bin/splash -s -u 0 /usr/share/bootsplash/bootsplash.cfg
		
		# switch to vt1 (must be &'d otherwise script hangs)
		/usr/bin/chvt 1 &
		
		eend $? "Failed to set frame buffer console images"
		
	fi
}
