#! /bin/sh

package/packagecheck || exit 1

ok=1

# need publicfile daemontools ucspi-tcp

/usr/local/publicfile/bin/ftpd 1 2 3 4 5 6 7 8 9 10 2>/dev/null >/dev/null
if test "$?" = 20 ; then 
	:
else
	# gentoo?
	if test -x /usr/bin/publicfile-conf ; then
		/usr/bin/ftpd 1 2 3 4 5 6 7 8 9 10 2>/dev/null >/dev/null
		if test "$?" = 20 ; then 
			PUBLICFILE_FTPD=/usr/bin/ftpd
			export PUBLICFILE_FTPD
			:
		else
			fail="publicfile"
			ok=0;
		fi
	else
		fail="publicfile"
		ok=0;
	fi
fi

svc 2>/dev/null >/dev/null
if test "$?" = 0 ; then 
	:
else
	ok=0;
	fail="$fail daemontools"
fi

tcpserver 2>/dev/null >/dev/null
if test "$?" = 100 ; then 
	:
else
	ok=0;
	fail="$fail ucspi-tcp"
fi

if test "x$ok" = x0 ; then
	echo "Check not done: missing $fail" >&2
	exit 0
fi
cd compile || exit 1
exec make check
