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

Contents of /eclass/selinux-policy-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Oct 9 23:48:24 2006 UTC (7 years, 9 months ago) by pebenito
Branch: MAIN
selinux reference policy eclass initial commit

1 pebenito 1.1 # Copyright 1999-2006 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: $
4    
5     # Eclass for installing SELinux policy, and optionally
6     # reloading the reference-policy based modules
7    
8     inherit eutils
9    
10     IUSE=""
11    
12     HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/"
13     SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2"
14    
15     LICENSE="GPL-2"
16     SLOT="0"
17     S="${WORKDIR}/"
18    
19     RDEPEND=">=sys-apps/policycoreutils-1.30.30
20     >=sec-policy/selinux-base-policy-${PV}"
21    
22     DEPEND="${RDEPEND}
23     sys-devel/m4
24     >=sys-apps/checkpolicy-1.30.12"
25    
26     selinux-policy-2_src_unpack() {
27     unpack ${A}
28    
29     local modfiles
30    
31     for i in ${MODS}; do
32     modfiles="`find ${S}/refpolicy/policy/modules -iname $i.te` $modfiles"
33     modfiles="`find ${S}/refpolicy/policy/modules -iname $i.fc` $modfiles"
34     # use .if from headers
35     done
36    
37     for i in ${POLICY_TYPES}; do
38     mkdir ${S}/${i}
39     cp ${S}/refpolicy/doc/Makefile.example ${S}/${i}/Makefile
40    
41     cp ${modfiles} ${S}/${i}
42     done
43     }
44    
45     selinux-policy-2_src_compile() {
46     for i in ${POLICY_TYPES}; do
47     make NAME=$i -C ${S}/${i} || die "${i} compile failed"
48     done
49     }
50    
51     selinux-policy-2_src_install() {
52     BASEDIR="/usr/share/selinux"
53    
54     for i in ${POLICY_TYPES}; do
55     for j in ${MODS}; do
56     echo "Installing ${i} ${j} policy package"
57     insinto ${BASEDIR}/${i}
58     doins ${S}/${i}/${j}.pp
59     done
60     done
61     }
62    
63     selinux-policy-2_pkg_postinst() {
64     # build up the command in the case of multiple modules
65     local COMMAND
66     for i in ${MODS}; do
67     COMMAND="-i ${i}.pp ${COMMAND}"
68     done
69    
70     if has "loadpolicy" $FEATURES ; then
71     for i in ${POLICY_TYPES}; do
72     einfo "Inserting the following modules into the $i module store: ${MODS}"
73    
74     cd /usr/share/selinux/${i}
75     semodule -s ${i} ${COMMAND}
76     done
77     else
78     echo
79     echo
80     eerror "Policy has not been loaded. It is strongly suggested"
81     eerror "that the policy be loaded before continuing!!"
82     echo
83     einfo "Automatic policy loading can be enabled by adding"
84     einfo "\"loadpolicy\" to the FEATURES in make.conf."
85     echo
86     echo
87     ebeep 4
88     epause 4
89     fi
90     }
91    
92     EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20