#! /bin/sh
#
# megactlnode        This script keeps the megadev0 device node 
#                     up to date with the proper major number.
#
# chkconfig: 35 2 2 
# description: keeps the megadev0 device node up to date with \
#              the proper major number.

megactlpath=/dev/megaraid_sas_ioctl
minor=0

start() {
        rm -f $megactlpath
        major=`awk '{ if ($2 == "megaraid_sas_ioctl") print $1; }' /proc/devices`
        if [ -n "$major" ]; then
           mknod $megactlpath c $major $minor
        fi
	return 0
}

stop() {
	return 0
}

restart() {
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart)
	restart
	;;
  *)
	echo $"Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?
