#!/bin/sh -e
#
# bootup for gom 0.29.99+: initialize mixer(s)
#
# (c) 1998-2000 Stephan A Suerken <absurd@debian.org>
#

#
# Silent exits
#
gom_cmd=/usr/bin/gom-ct
sound_driver=/proc/sound
no_auto_init=/etc/gom/NO_AUTO_INIT

# gom.deb is removed but not purged
[ -x ${gom_cmd} ] || exit 0

# No sound driver (yet)
[ -e ${sound_driver} ] || exit 0

# Explicit configuration
[ ! -e ${no_auto_init} ] || exit 0

#
# Initialization
#
case "$1" in
	# At this point, gom is installed properly and the (oss) sound
	# driver is present.
	# Won't fail even if configuration is invalid.
	start|restart|reload|force-reload)
		echo -n "Gom initializing audio mixer(s)..."
		if ${gom_cmd} --quiet --initialize >/dev/null 2>&1 ;
#		if ${gom_cmd} --quiet --initialize ;
		    then echo "done."
		    else echo "some errors. Check 'gom --initialize'."
		fi
		;;
	stop)
		;;
	*)
		echo "Usage: /etc/init.d/gom {start|restart|reload|force-reload|stop}" >&2
		echo
		echo "       start|restart|reload|force-reload  initializes audio mixer(s)." >&2
		echo "       stop                               does nothing." >&2
		exit 1
		;;
esac

exit 0

