#!/bin/sh

# Author: iSteve <isteve@bofh.cz>
#
# Note that this script is untested!
#
# Modified by Sigma Designs, 2008
#

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/bin
DESC="Hotplug2"
NAME=hotplug2
DAEMON=/sbin/$NAME
DAEMON_ARGS="--no-coldplug --persistent --override --max-children 1"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

case "$1" in
  start)
# 	[ -x $DAEMON ] && $DAEMON $DAEMON_ARGS &
	if [ ! -d /i-stor ]; then
	    mkdir -p /i-stor
	fi

	if [ ! -d /e-stor ]; then
	    mkdir -p /e-stor
	fi

# 	$DAEMON --coldplug&
# 	$DAEMON $DAEMON_ARGS&
 	start-stop-daemon -S -v -b -m -p $PIDFILE -x $DAEMON -- $DAEMON_ARGS
	;;
  stop)
	start-stop-daemon -K -q -o --exec $DAEMON
	rm -f $PIDFILE
	;;
  *)
	echo "Usage: $SCRIPTNAME {start|stop}" >&2
	exit 3
	;;
esac

exit 0
