2005-10-19 21:20:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2006-04-18 15:30:53 +00:00
|
|
|
DISTROS="rhel4 gentoo debian"
|
|
|
|
TYPES="strict targeted strict-mcs targeted-mcs strict-mls targeted-mls"
|
2005-10-19 21:20:07 +00:00
|
|
|
POLVER="`checkpolicy -V |cut -f 1 -d ' '`"
|
|
|
|
SETFILES="/usr/sbin/setfiles"
|
2006-05-16 18:36:25 +00:00
|
|
|
SE_LINK="time -p /usr/bin/semodule_link"
|
2005-10-19 21:20:07 +00:00
|
|
|
|
2006-04-18 15:30:53 +00:00
|
|
|
die() {
|
|
|
|
if [ "$1" -eq "1" ]; then
|
|
|
|
echo "failed with options: $2"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2006-05-16 18:36:25 +00:00
|
|
|
cleanup_mon() {
|
|
|
|
make MONOLITHIC=y bare
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup_mod() {
|
2006-04-18 15:30:53 +00:00
|
|
|
make MONOLITHIC=n bare
|
|
|
|
}
|
|
|
|
|
2005-10-22 03:15:40 +00:00
|
|
|
do_test() {
|
2005-10-19 21:20:07 +00:00
|
|
|
local OPTS=""
|
|
|
|
|
|
|
|
for i in $TYPES; do
|
2005-10-22 03:15:40 +00:00
|
|
|
# Monolithic tests
|
2006-05-16 18:36:25 +00:00
|
|
|
trap cleanup_mon SIGINT SIGQUIT
|
2006-04-18 15:30:53 +00:00
|
|
|
OPTS="TYPE=$i MONOLITHIC=y QUIET=y DIRECT_INITRC=y"
|
2005-10-19 21:20:07 +00:00
|
|
|
[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
|
|
|
|
echo "**** Options: $OPTS ****"
|
2005-12-07 16:42:33 +00:00
|
|
|
echo -ne "\33]0;mon $i $1\007"
|
2006-04-18 15:30:53 +00:00
|
|
|
make $OPTS conf || die "$?" "$OPTS"
|
|
|
|
make $OPTS || die "$?" "$OPTS"
|
|
|
|
make $OPTS file_contexts || die "$?" "$OPTS"
|
|
|
|
$SETFILES -q -c policy.$POLVER file_contexts || die "$?" "$OPTS"
|
2006-05-16 18:36:25 +00:00
|
|
|
cleanup_mon
|
2005-10-19 21:20:07 +00:00
|
|
|
|
2005-10-22 03:15:40 +00:00
|
|
|
# Loadable module tests
|
2006-05-16 18:36:25 +00:00
|
|
|
trap cleanup_mod SIGINT SIGQUIT
|
2006-04-18 15:30:53 +00:00
|
|
|
OPTS="TYPE=$i MONOLITHIC=n QUIET=y DIRECT_INITRC=y"
|
2005-10-19 21:20:07 +00:00
|
|
|
[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
|
|
|
|
echo "**** Options: $OPTS ****"
|
2005-12-07 16:42:33 +00:00
|
|
|
echo -ne "\33]0;mod $i $1\007"
|
2006-04-18 15:30:53 +00:00
|
|
|
make $OPTS conf || die "$?" "$OPTS"
|
|
|
|
make $OPTS base || die "$?" "$OPTS"
|
|
|
|
make $OPTS -j2 modules || die "$?" "$OPTS"
|
2005-10-19 21:20:07 +00:00
|
|
|
mv base.pp tmp
|
2006-04-18 15:30:53 +00:00
|
|
|
############# FIXME
|
|
|
|
rm dmesg.pp
|
|
|
|
$SE_LINK tmp/base.pp *.pp || die "$?" "$OPTS"
|
2006-05-16 18:36:25 +00:00
|
|
|
cleanup_mod
|
2005-10-19 21:20:07 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2006-05-16 18:36:25 +00:00
|
|
|
cleanup_mon
|
|
|
|
cleanup_mod
|
2005-10-22 03:15:40 +00:00
|
|
|
do_test
|
2005-10-19 21:20:07 +00:00
|
|
|
|
2006-05-16 18:36:25 +00:00
|
|
|
for i in $DISTROS; do
|
|
|
|
do_test $i
|
|
|
|
done
|
|
|
|
|
2005-10-19 21:20:07 +00:00
|
|
|
echo "Completed successfully."
|