/[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.2 - (hide annotations) (download)
Wed Oct 25 11:27:36 2006 UTC (7 years, 10 months ago) by pebenito
Branch: MAIN
Changes since 1.1: +9 -4 lines
fix selinux policy eclass to have default POLICY_TYPES if it is empty.

1 pebenito 1.1 # Copyright 1999-2006 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 pebenito 1.2 # $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy-2.eclass,v 1.1 2006/10/09 23:48:24 pebenito Exp $
4 pebenito 1.1
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 pebenito 1.2 local modfiles
28     [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted"
29    
30 pebenito 1.1 unpack ${A}
31    
32     for i in ${MODS}; do
33     modfiles="`find ${S}/refpolicy/policy/modules -iname $i.te` $modfiles"
34     modfiles="`find ${S}/refpolicy/policy/modules -iname $i.fc` $modfiles"
35     # use .if from headers
36     done
37    
38     for i in ${POLICY_TYPES}; do
39     mkdir ${S}/${i}
40     cp ${S}/refpolicy/doc/Makefile.example ${S}/${i}/Makefile
41    
42     cp ${modfiles} ${S}/${i}
43     done
44     }
45    
46     selinux-policy-2_src_compile() {
47 pebenito 1.2 [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted"
48    
49 pebenito 1.1 for i in ${POLICY_TYPES}; do
50     make NAME=$i -C ${S}/${i} || die "${i} compile failed"
51     done
52     }
53    
54     selinux-policy-2_src_install() {
55 pebenito 1.2 [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted"
56     local BASEDIR="/usr/share/selinux"
57 pebenito 1.1
58     for i in ${POLICY_TYPES}; do
59     for j in ${MODS}; do
60     echo "Installing ${i} ${j} policy package"
61     insinto ${BASEDIR}/${i}
62     doins ${S}/${i}/${j}.pp
63     done
64     done
65     }
66    
67     selinux-policy-2_pkg_postinst() {
68     # build up the command in the case of multiple modules
69     local COMMAND
70     for i in ${MODS}; do
71     COMMAND="-i ${i}.pp ${COMMAND}"
72     done
73 pebenito 1.2 [ -z "${POLICY_TYPES}" ] && local POLICY_TYPES="strict targeted"
74 pebenito 1.1
75     if has "loadpolicy" $FEATURES ; then
76     for i in ${POLICY_TYPES}; do
77     einfo "Inserting the following modules into the $i module store: ${MODS}"
78    
79     cd /usr/share/selinux/${i}
80     semodule -s ${i} ${COMMAND}
81     done
82     else
83     echo
84     echo
85     eerror "Policy has not been loaded. It is strongly suggested"
86     eerror "that the policy be loaded before continuing!!"
87     echo
88     einfo "Automatic policy loading can be enabled by adding"
89     einfo "\"loadpolicy\" to the FEATURES in make.conf."
90     echo
91     echo
92     ebeep 4
93     epause 4
94     fi
95     }
96    
97     EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20