fix for bug #65487. only do loadpolicy if all tools are available
authorChris PeBenito <pebenito@gentoo.org>
Fri, 8 Oct 2004 01:36:47 +0000 (01:36 +0000)
committerChris PeBenito <pebenito@gentoo.org>
Fri, 8 Oct 2004 01:36:47 +0000 (01:36 +0000)
eclass/selinux-policy.eclass

index 0435a15f0cec6d5bc21da12665c9008f2a436a57..43d51c2ae21f25a764c83a81ee2e83fd0579ab4c 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy.eclass,v 1.11 2004/09/06 01:09:02 pebenito Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy.eclass,v 1.12 2004/10/08 01:36:47 pebenito Exp $
 
 # Eclass for installing SELinux policy, and optionally
 # reloading the policy
@@ -64,20 +64,24 @@ selinux-policy_src_install() {
 
 selinux-policy_pkg_postinst() {
        if has "loadpolicy" $FEATURES ; then
-               ebegin "Automatically loading policy"
-               make -C ${POLICYDIR} load
-               eend $?
-
-               ebegin "Regenerating file contexts"
-               [ -f ${POLICYDIR}/file_contexts/file_contexts ] && \
-                       rm -f ${POLICYDIR}/file_contexts/file_contexts
-               make -C ${POLICYDIR} file_contexts/file_contexts &> /dev/null
-
-               # do a test relabel to make sure file
-               # contexts work (doesnt change any labels)
-               echo "/etc/passwd" | /usr/sbin/setfiles \
-                       ${POLICYDIR}/file_contexts/file_contexts -sqn
-               eend $?
+               if [ -x /usr/bin/checkpolicy -a -x /usr/sbin/load_policy -a -x /usr/sbin/setfiles ]; then
+                       # only do this if all tools are installed
+
+                       ebegin "Automatically loading policy"
+                       make -C ${POLICYDIR} load
+                       eend $?
+
+                       ebegin "Regenerating file contexts"
+                       [ -f ${POLICYDIR}/file_contexts/file_contexts ] && \
+                               rm -f ${POLICYDIR}/file_contexts/file_contexts
+                       make -C ${POLICYDIR} file_contexts/file_contexts &> /dev/null
+
+                       # do a test relabel to make sure file
+                       # contexts work (doesnt change any labels)
+                       echo "/etc/passwd" | /usr/sbin/setfiles \
+                               ${POLICYDIR}/file_contexts/file_contexts -sqn
+                       eend $?
+               fi
        else
                echo
                echo