#! /bin/sh
### BEGIN INIT INFO
# Provides:        mmcdev
# Required-Start:  hpnid
# Required-Stop:
# Default-Start:   3 4 5
# Default-Stop:
# Description:     
### END INIT INFO

 
# Source function library.
. /etc/rc.config
. /etc/rc.status
 
test -x /usr/hpserver/bin/mmcdev_load || exit 0
test -x /usr/hpserver/bin/mmcdev_unload || exit 0
 
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
 
# Force execution if not called by a runlevel directory.
test $link = $base && INSMOD_MMCDEV="yes"
test "$INSMOD_MMCDEV" = yes || exit 0
 
#
#       See how we were called.
#
return=$rc_done
case "$1" in
  start)
        # Check if mmcdev is loaded
        echo -n 'Loading HP MMC device module: '
        /usr/hpserver/bin/mmcdev_load || return="$rc_failed"
        echo -e "$return"
        ;;
  stop)
        echo -n 'Unloading HP MMC device module: '
        /usr/hpserver/bin/mmcdev_unload || return="$rc_failed"
        echo -e "$return"
        ;;
  reload|restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: /etc/init.d/mmcdev {start|stop|restart|reload}"
        exit 1
esac
 
test "$return" = "$rc_done" || exit 1
exit 0   
