Chris PeBenito fdef43
#!/bin/bash
Chris PeBenito fdef43
Chris PeBenito 686f13
DISTROS="redhat gentoo debian suse"
Chris PeBenito fdef43
TYPES="strict strict-mls strict-mcs targeted targeted-mls targeted-mcs"
Chris PeBenito fdef43
POLVER="`checkpolicy -V |cut -f 1 -d ' '`"
Chris PeBenito fdef43
SETFILES="/usr/sbin/setfiles"
Chris PeBenito fdef43
SE_LINK="/usr/bin/semodule_link"
Chris PeBenito fdef43
Chris PeBenito 959fca
do_test() {
Chris PeBenito fdef43
	local OPTS=""
Chris PeBenito fdef43
Chris PeBenito fdef43
	for i in $TYPES; do
Chris PeBenito 959fca
		# Monolithic tests
Chris PeBenito fdef43
		OPTS="TYPE=$i QUIET=@ DIRECT_INITRC=y"
Chris PeBenito fdef43
		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
Chris PeBenito fdef43
		echo "**** Options: $OPTS ****"
Chris PeBenito 686f13
		echo -ne "\33]0;mon $i $1\007"
Chris PeBenito fdef43
		make $OPTS conf || exit 1
Chris PeBenito fdef43
		make $OPTS || exit 1
Chris PeBenito fdef43
		make $OPTS file_contexts || exit 1
Chris PeBenito fdef43
		$SETFILES -q -c policy.$POLVER file_contexts || exit 1
Chris PeBenito fdef43
		make $OPTS bare || exit 1
Chris PeBenito fdef43
Chris PeBenito 959fca
		# Loadable module tests
Chris PeBenito fdef43
		OPTS="TYPE=$i MONOLITHIC=n QUIET=@ DIRECT_INITRC=y"
Chris PeBenito fdef43
		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
Chris PeBenito fdef43
		echo "**** Options: $OPTS ****"
Chris PeBenito 686f13
		echo -ne "\33]0;mod $i $1\007"
Chris PeBenito fdef43
		make $OPTS conf || exit 1
Chris PeBenito 959fca
		make $OPTS all || exit 1
Chris PeBenito fdef43
		mv base.pp tmp
Chris PeBenito 686f13
#		$SE_LINK tmp/base.pp *.pp || exit 1
Chris PeBenito fdef43
		make $OPTS bare || exit 1
Chris PeBenito fdef43
	done
Chris PeBenito fdef43
}
Chris PeBenito fdef43
Chris PeBenito 959fca
make bare || exit 1
Chris PeBenito 959fca
make MONOLITHIC=n bare || exit 1
Chris PeBenito fdef43
Chris PeBenito 959fca
do_test
Chris PeBenito fdef43
Chris PeBenito fdef43
for i in $DISTROS; do
Chris PeBenito 959fca
	do_test $i
Chris PeBenito fdef43
done
Chris PeBenito fdef43
Chris PeBenito fdef43
echo "Completed successfully."