summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/policycoreutils/files')
-rw-r--r--sys-apps/policycoreutils/files/selinux-init28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys-apps/policycoreutils/files/selinux-init b/sys-apps/policycoreutils/files/selinux-init
new file mode 100644
index 000000000000..f7541565e8eb
--- /dev/null
+++ b/sys-apps/policycoreutils/files/selinux-init
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+mount -n -t proc none /proc
+
+# see if selinuxfs is available
+for i in $(cat /proc/filesystems); do
+ [ "$i" == "selinuxfs" ] && ENABLED=y
+done
+
+umount -n /proc
+
+if [ -n ${ENABLED} ]; then
+ # only try to load policy on SELinux kernels
+
+ mount -n -t selinuxfs none /selinux
+
+ # determine the policy version
+ [ -f /selinux/policyvers ] && \
+ POLICYVER=$(cat /selinux/policyvers) || \
+ POLICYVER=15
+
+ # load the policy if it exists
+ [ -f /etc/security/selinux/policy.${POLICYVER} ] && \
+ /usr/sbin/load_policy /etc/security/selinux/policy.${POLICYVER} || \
+ echo "Unable to load policy: /etc/security/selinux/policy.${POLICYVER} missing."
+fi
+
+exec /sbin/init