summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris PeBenito <pebenito@gentoo.org>2003-11-24 04:11:37 +0000
committerChris PeBenito <pebenito@gentoo.org>2003-11-24 04:11:37 +0000
commitc69e620d0ee7885d8cc160c96dcaeb8a5d127f16 (patch)
tree6b867e0377cc902f47676203454465a25a27a1f1 /sys-apps/policycoreutils/files
parentFixes bug #34130 (diff)
downloadgentoo-2-c69e620d0ee7885d8cc160c96dcaeb8a5d127f16.tar.gz
gentoo-2-c69e620d0ee7885d8cc160c96dcaeb8a5d127f16.tar.bz2
gentoo-2-c69e620d0ee7885d8cc160c96dcaeb8a5d127f16.zip
add selinux-init, which will be used in next upstream policycoreutils release
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