# If the currently running init daemon is upstart, return zero; if the
# calling init script belongs to a package which also provides a native
# upstart job, it should generally exit non-zero in this case.
init_is_upstart()
{
   if [ -x /sbin/initctl ] && /sbin/initctl version 2>/dev/null | /bin/grep -q upstart; then
       return 0
   fi
   return 1
}

if init_is_upstart; then
    upstart_job=/etc/init/$(basename ${0:-}).conf
    if [ -f ${upstart_job:-} ] && [ ! -L ${upstart_job:-} ]; then
	case "${1:-}" in
	    start|restart|force-reload)
		exit 1
		;;
	    stop)
		exit 0
		;;
	esac
    fi
fi
