summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-security/selinux/selinux-autorelabel/selinux-autorelabel.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/recipes-security/selinux/selinux-autorelabel/selinux-autorelabel.sh b/recipes-security/selinux/selinux-autorelabel/selinux-autorelabel.sh
index 154dad1..25b6921 100644
--- a/recipes-security/selinux/selinux-autorelabel/selinux-autorelabel.sh
+++ b/recipes-security/selinux/selinux-autorelabel/selinux-autorelabel.sh
@@ -3,16 +3,19 @@
3/usr/sbin/selinuxenabled 2>/dev/null || exit 0 3/usr/sbin/selinuxenabled 2>/dev/null || exit 0
4 4
5FIXFILES=/sbin/fixfiles 5FIXFILES=/sbin/fixfiles
6SETENFORCE=/usr/sbin/setenforce
6 7
7if ! test -x ${FIXFILES}; then 8for i in ${FIXFILES} ${SETENFORCE}; do
8 echo "${FIXFILES} is missing in the system." 9 test -x $i && continue
10 echo "$i is missing in the system."
9 echo "Please add \"selinux=0\" in the kernel command line to disable SELinux." 11 echo "Please add \"selinux=0\" in the kernel command line to disable SELinux."
10 exit 1 12 exit 1
11fi 13done
12 14
13# If /.autorelabel placed, the whole file system should be relabeled 15# If /.autorelabel placed, the whole file system should be relabeled
14if [ -f /.autorelabel ]; then 16if [ -f /.autorelabel ]; then
15 echo "SELinux: /.autorelabel placed, filesystem will be relabeled..." 17 echo "SELinux: /.autorelabel placed, filesystem will be relabeled..."
18 ${SETENFORCE} 0
16 ${FIXFILES} -F -f relabel 19 ${FIXFILES} -F -f relabel
17 /bin/rm -f /.autorelabel 20 /bin/rm -f /.autorelabel
18 echo " * Relabel done, rebooting the system." 21 echo " * Relabel done, rebooting the system."