aboutsummaryrefslogtreecommitdiff
path: root/selinux_pols/build_all.sh
blob: 286cdc84ec431f74946a09d250150b228fd6e00d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

BDIR=$(dirname ${0})

function run_cmd {
	cmd="${1}"
	echo "${cmd}"
	$cmd
	return $?
}

echo "$0: building all in $BDIR" >&2
for file in ${BDIR}/*.te; do
	echo "* building: $file"
	fname=$(basename ${file} | sed -e 's/^\(.*\)\.\(.*\)$/\1/g')
	run_cmd "checkmodule -m -M -o ${BDIR}/${fname}.mod ${BDIR}/${fname}.te"
	if [ $? -ne 0 ]; then
		echo "checkmodule: ERROR, next .." >&2
		continue
	fi
	run_cmd "semodule_package -m ${BDIR}/${fname}.mod -o ${BDIR}/${fname}.pp"
	if [ $? -ne 0 ]; then
		echo "semodule_package: ERROR, next .." >&2
		continue
	fi
	run_cmd "semodule -i ${BDIR}/${fname}.pp"
	run_cmd "semodule -e ${fname}"
done

echo "done."
exit 0