/[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.4 - (hide annotations) (download)
Sun Aug 2 02:58:25 2009 UTC (5 years, 4 months ago) by pebenito
Branch: MAIN
Changes since 1.3: +7 -7 lines
fix unqouted variables in selinux policy eclasses to fix bug #258227.

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

  ViewVC Help
Powered by ViewVC 1.1.20