Chris PeBenito b51f2f
#!/bin/bash
Chris PeBenito b51f2f
Chris PeBenito b51f2f
DISTROS="redhat gentoo debian suse"
Chris PeBenito b51f2f
STRICT_TYPES="strict strict-mls"
Chris PeBenito b51f2f
TARG_TYPES="targeted targeted-mls"
Chris PeBenito b51f2f
POLVER="`checkpolicy -V |cut -f 1 -d ' '`"
Chris PeBenito b51f2f
SETFILES="/usr/sbin/setfiles"
Chris PeBenito b51f2f
Chris PeBenito b51f2f
do_test() {
Chris PeBenito b51f2f
	local OPTS=""
Chris PeBenito b51f2f
Chris PeBenito b51f2f
	for i in $STRICT_TYPES; do
Chris PeBenito b51f2f
		OPTS="TYPE=$i QUIET=@"
Chris PeBenito b51f2f
		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
Chris PeBenito b51f2f
		make bare || exit 1
Chris PeBenito b51f2f
		echo "**** Options: $OPTS ****"
Chris PeBenito b51f2f
		make $OPTS conf || exit 1
Chris PeBenito b51f2f
		make $OPTS || exit 1
Chris PeBenito b51f2f
		make $OPTS file_contexts || exit 1
Chris PeBenito b51f2f
		$SETFILES -q -c policy.$POLVER file_contexts || exit 1
Chris PeBenito b51f2f
	done
Chris PeBenito b51f2f
Chris PeBenito b51f2f
	# need a specific config for targeted policy
Chris PeBenito b51f2f
	for i in $TARG_TYPES; do
Chris PeBenito b51f2f
		OPTS="TYPE=$i QUIET=@"
Chris PeBenito b51f2f
		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
Chris PeBenito b51f2f
		make bare || exit 1
Chris PeBenito b51f2f
		echo "**** Options: $OPTS ****"
Chris PeBenito b51f2f
		cp policy/modules.conf.targeted_example policy/modules.conf
Chris PeBenito b51f2f
		make $OPTS conf || exit 1
Chris PeBenito b51f2f
		make $OPTS || exit 1
Chris PeBenito b51f2f
		make $OPTS file_contexts || exit 1
Chris PeBenito b51f2f
		$SETFILES -q -c policy.$POLVER file_contexts|| exit 1
Chris PeBenito b51f2f
	done
Chris PeBenito b51f2f
}
Chris PeBenito b51f2f
Chris PeBenito b51f2f
# first to generic test
Chris PeBenito b51f2f
do_test
Chris PeBenito b51f2f
Chris PeBenito b51f2f
# now distro-specitic test
Chris PeBenito b51f2f
for i in $DISTROS; do
Chris PeBenito b51f2f
	do_test $i
Chris PeBenito b51f2f
done
Chris PeBenito b51f2f
Chris PeBenito b51f2f
# clean up
Chris PeBenito b51f2f
make bare
Chris PeBenito b51f2f
echo "Completed successfully."