#!/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.
if [ -e /proc/device-tree/model ]; then
	device=$(cat /proc/device-tree/model)
else
	device=$(grep "Hardware[[:space:]]*:" /proc/cpuinfo 2>/dev/null | \
		 head -n1 | sed "s/^[^:]*: //")
fi
case $device in
    "QNAP TS-119/TS-219") break ;;
    "QNAP TS219 family")  break ;;
    "QNAP TS-41x")        break ;;
    "QNAP TS419 family")  break ;;
    *)                    exit 0 ;;
esac

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

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

exit 0
