summaryrefslogtreecommitdiffstats
path: root/recipes-security/selinux/selinux-autorelabel/selinux-autorelabel.sh
blob: 154dad11e3d5e25ad74a3341342a888042f8eee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

/usr/sbin/selinuxenabled 2>/dev/null || exit 0

FIXFILES=/sbin/fixfiles

if ! test -x ${FIXFILES}; then
	echo "${FIXFILES} is missing in the system."
	echo "Please add \"selinux=0\" in the kernel command line to disable SELinux."
	exit 1
fi

# If /.autorelabel placed, the whole file system should be relabeled
if [ -f /.autorelabel ]; then
	echo "SELinux: /.autorelabel placed, filesystem will be relabeled..."
	${FIXFILES} -F -f relabel
	/bin/rm -f /.autorelabel
	echo " * Relabel done, rebooting the system."
	/sbin/reboot
fi

exit 0