#!/bin/sh
# Qcontrol boot script, disables watchdog

PREREQ=""
prereqs()
{
     echo "$PREREQ"
}

case $1 in
prereqs)
     prereqs
     exit 0
     ;;
esac

. /scripts/functions
# Begin real processing below this line

# Only needed on TS-219P II and TS-419P II, safe to call on any TS-x19 though.
device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
	 head -n1 | sed "s/^[^:]*: //")
case $device in
    "QNAP TS-119/TS-219") break ;;
    "QNAP TS-41x")        break ;;
    *)                    exit 0 ;;
esac

if [ ! -x "/sbin/qcontrol" ]; then
    exit 0
fi

/sbin/qcontrol --direct watchdog off || true

exit 0
