/[gentoo-x86]/eclass/selinux-policy.eclass
Gentoo

Contents of /eclass/selinux-policy.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (show annotations) (download)
Mon Aug 17 17:35:45 2009 UTC (5 years, 1 month ago) by pebenito
Branch: MAIN
CVS Tags: HEAD
Changes since 1.17: +1 -1 lines
FILE REMOVED
remove old, unusued selinux-policy.eclass

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy.eclass,v 1.17 2009/08/02 02:58:25 pebenito Exp $
4
5 # Eclass for installing SELinux policy, and optionally
6 # reloading the policy
7
8 inherit eutils
9
10 HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/"
11 SRC_URI="mirror://gentoo/${P}.tar.bz2"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 S="${WORKDIR}/${PN/selinux-}"
16
17 IUSE=""
18
19 RDEPEND=">=sec-policy/selinux-base-policy-20030729"
20
21 selinux-policy_src_compile() {
22 cd "${S}"
23
24 [ -z "${POLICYDIR}" ] && POLICYDIR="/etc/security/selinux/src/policy"
25 SAVENAME="`date +%Y%m%d%H%M`-${PN}.tar.bz2"
26 SAVEDIR="`echo "${POLICYDIR}" | cut -d/ -f6`"
27
28 einfo "Backup of policy source is \"${SAVENAME}\"."
29 debug-print "POLICYDIR is \"${POLICYDIR}\""
30 debug-print "SAVEDIR is \"${SAVEDIR}\""
31
32 # create a backup of the current policy
33 tar -C /etc/security/selinux/src --exclude tmp \
34 --exclude policy.conf -jcf ${SAVENAME} ${SAVEDIR}/
35 }
36
37 selinux-policy_src_install() {
38 cd "${S}"
39
40 insinto /etc/security/selinux/src/policy-backup
41 doins *-${PN}.tar.bz2
42
43 if [ -n "${TEFILES}" ]; then
44 debug-print "TEFILES is \"${TEFILES}\""
45 insinto ${POLICYDIR}/domains/program
46 doins ${TEFILES} || die
47 fi
48
49 if [ -n "${TEMISC}" ]; then
50 debug-print "TEMISC is \"${TEMISC}\""
51 insinto ${POLICYDIR}/domains/misc
52 doins ${TEMISC} || die
53 fi
54
55 if [ -n "${FCFILES}" ]; then
56 debug-print "FCFILES is \"${FCFILES}\""
57 insinto ${POLICYDIR}/file_contexts/program
58 doins ${FCFILES} || die
59 fi
60
61 if [ -n "${FCMISC}" ]; then
62 debug-print "FCMISC is \"${FCMISC}\""
63 insinto ${POLICYDIR}/file_contexts/misc
64 doins ${FCMISC} || die
65 fi
66
67 if [ -n "${MACROS}" ]; then
68 debug-print "MACROS is \"${MACROS}\""
69 insinto ${POLICYDIR}/macros/program
70 doins ${MACROS} || die
71 fi
72 }
73
74 selinux-policy_pkg_postinst() {
75 if has "loadpolicy" $FEATURES ; then
76 if [ -x /usr/bin/checkpolicy -a -x /usr/sbin/load_policy -a -x /usr/sbin/setfiles ]; then
77 # only do this if all tools are installed
78
79 ebegin "Automatically loading policy"
80 make -C ${POLICYDIR} load
81 eend $?
82
83 ebegin "Regenerating file contexts"
84 [ -f ${POLICYDIR}/file_contexts/file_contexts ] && \
85 rm -f ${POLICYDIR}/file_contexts/file_contexts
86 make -C ${POLICYDIR} file_contexts/file_contexts &> /dev/null
87
88 # do a test relabel to make sure file
89 # contexts work (doesnt change any labels)
90 echo "/etc/passwd" | /usr/sbin/setfiles \
91 ${POLICYDIR}/file_contexts/file_contexts -sqn
92 eend $?
93 fi
94 else
95 echo
96 echo
97 eerror "Policy has not been loaded. It is strongly suggested"
98 eerror "that the policy be loaded before continuing!!"
99 echo
100 einfo "Automatic policy loading can be enabled by adding"
101 einfo "\"loadpolicy\" to the FEATURES in make.conf."
102 echo
103 echo
104 ebeep 4
105 epause 4
106 fi
107 }
108
109 EXPORT_FUNCTIONS src_compile src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20