#!/bin/bash

test -x /usr/hpserver/bin/mmcdev_load || exit 1
test -x /usr/hpserver/bin/mmcdev_unload || exit 1

case "$1" in
  start)
  	lsmod | grep mmcdev > /dev/null 2>&1
	if [ $? != 0 ]; then
		echo -n "Loading HP MMC device module: mmcdev"
		/usr/hpserver/bin/mmcdev_load
		echo "."
	fi
	;;
  stop)
  	lsmod | grep mmcdev > /dev/null 2>&1
	if [ $? = 0 ]; then
		echo -n "Unloading HP MMC device module: mmcdev"
		/usr/hpserver/bin/mmcdev_unload
		echo "."
	fi
	;;
  reload|restart)
  	$0 stop
	$0 start
	;;
  *)
	echo "Usage: /etc/init.d/mmcdev {start|stop|restart|reload}"
	exit 1
	;;
esac;
