diff options
| -rw-r--r-- | recipes-security/selinux/selinux-autorelabel/selinux-autorelabel.sh | 9 |
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 | ||
| 5 | FIXFILES=/sbin/fixfiles | 5 | FIXFILES=/sbin/fixfiles |
| 6 | SETENFORCE=/usr/sbin/setenforce | ||
| 6 | 7 | ||
| 7 | if ! test -x ${FIXFILES}; then | 8 | for 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 |
| 11 | fi | 13 | done |
| 12 | 14 | ||
| 13 | # If /.autorelabel placed, the whole file system should be relabeled | 15 | # If /.autorelabel placed, the whole file system should be relabeled |
| 14 | if [ -f /.autorelabel ]; then | 16 | if [ -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." |
