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

set -u

if [ "$1" = start ]; then
    $OPTTOP/ACPI/load_modules
    if [ $? -ne 0 ]; then
	FAILMSG="Could not load HP ACPI module\n\nSee the README in $OPTTOP/ACPI"
    else
	DEV=`grep 'acpi$' /proc/devices | awk '{print $1}'`
	if [ -z "$DEV" ]; then
	    FAILMSG="ACPI device major number not found"
	else # build a new dev file in case modules were reloaded
	    rm -f /dev/acpi
	    mknod -m 600 /dev/acpi c $DEV 0
	fi
    fi
fi

exit 0
