#!/bin/bash
# must be executable otherwise it won't work on debian

set -u

if [ "$1" = start ]; then
    $OPTTOP/OpenIPMI/load_modules
    if [ $? -ne 0 ]; then
	FAILMSG="Could not load Open IPMI modules\n\nSee the README in $OPTTOP/OpenIPMI"
        echo $FAILMSG
    #else
	#DEV=`grep 'ipmidev$' /proc/devices | awk '{print $1}'`
	#if [ -z "$DEV" ]; then
	    #FAILMSG="IPMI device major number not found"
            #echo "IPMI device major number not found"
	#else # build a new dev file in case modules were reloaded
	    #rm -f /dev/ipmi0 /dev/ipmidev/0
	    #mknod -m 600 /dev/ipmi0 c $DEV 0
            #echo "mknod"
	    #mkdir -p /dev/ipmidev 2>/dev/null
	    3mknod -m 600 /dev/ipmidev/0 c $DEV 0

	    # hpbmc SetOANameStrings 2>/dev/null now in S04hpipmid

	#fi
    fi
fi

exit 0
