#!/bin/sh
# Kiran Kamity, 05/11/2004
# Any Netapp additions to the initial sequence of events that must run on
# the RLM go in this file
# Example: Adding user 'admin', etc...

case "$1" in
	start|"")

		# create NetApp proc fs entries
		insmod /usr/local/module/procfsfile.o

		# install the ECC handler
		insmod /usr/local/module/ecc.o

		# Loading the agent driver module
		insmod /usr/local/module/agentdrv.o
		chmod 666 /dev/agentdrv
		chmod 666 /dev/i2c/0
        
		if [ -f /var/run/InTestFixture ]; then
			# If in DIAG mode
			echo "DIAGS MODE"
			/usr/local/bin/set_debugmode.sh
			/usr/local/bin/diag
		else 
			# If in normal mode
			echo "NORMAL MODE"
			
			# Starting the agentd, eventd and seld
			/usr/local/bin/agentd 
			/usr/local/bin/eventd
			/usr/local/bin/seld

			# Starting the pktd_reader and pktd_writer	
			/usr/local/bin/pktd_reader 
			/usr/local/bin/pktd_writer 

			# Starting the selpktd
			/usr/local/bin/selpktd

			# Starting the console logger
			/usr/local/bin/logger
	
			# Starting the orftp daemons
			/usr/local/bin/orftp_sender
			/usr/local/bin/orftp_rcvr
			/usr/local/bin/fud_sp
			/usr/local/bin/configd

			# Starting the diagd 
			/usr/local/bin/diagd

			# Starting the loopd
			/usr/local/bin/loopd

			# Starting the downbeat
			/usr/local/bin/f2rbeat

			# Starting the upbeat
			/usr/local/bin/r2fbeat

			# Starting the asupd
			/usr/local/bin/asupd
			
			# Enabling root login & priv test for Golden RLM
			# Golden RLM has /mnt/logs/var/RLM_debugmode present
                	if [ -f "/mnt/logs/var/RLM_debugmode" ] ; then
			    sleep 10
                  	    /usr/local/bin/set_debugmode.sh
			fi
		fi
		;;
	stop)
            ;;  
        *)
	    echo "Usage: local {start|stop}" >&2
	    exit 1
	    ;; 
esac
