#!/bin/sh

unsupported() {
	echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
	echo "No shutdown command found" >&2
	exit 1
}

#Try for common tools
if [ -x "/sbin/shutdown" ] ; then
	/sbin/shutdown -hp now
	exit $?
elif [ -x "/usr/sbin/shutdown" ] ; then
	/usr/sbin/shutdown -p now
	exit $?
else
	unsupported
fi
