| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy-2.eclass,v 1.13 2012/07/26 12:53:01 swift Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy-2.eclass,v 1.14 2012/09/08 18:36:12 swift Exp $ |
| 4 | |
4 | |
| 5 | # Eclass for installing SELinux policy, and optionally |
5 | # Eclass for installing SELinux policy, and optionally |
| 6 | # reloading the reference-policy based modules. |
6 | # reloading the reference-policy based modules. |
| 7 | |
7 | |
| 8 | # @ECLASS: selinux-policy-2.eclass |
8 | # @ECLASS: selinux-policy-2.eclass |
| … | |
… | |
| 54 | # This variable is the same POLICY_TYPES variable that we tell SELinux |
54 | # This variable is the same POLICY_TYPES variable that we tell SELinux |
| 55 | # users to set in /etc/make.conf. Therefor, it is not the module that should |
55 | # users to set in /etc/make.conf. Therefor, it is not the module that should |
| 56 | # override it, but the user. |
56 | # override it, but the user. |
| 57 | : ${POLICY_TYPES:="targeted strict mcs mls"} |
57 | : ${POLICY_TYPES:="targeted strict mcs mls"} |
| 58 | |
58 | |
| 59 | inherit eutils |
59 | extra_eclass="" |
|
|
60 | case ${BASEPOL} in |
|
|
61 | 9999) extra_eclass="git-2"; |
|
|
62 | EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/hardened-refpolicy.git"; |
|
|
63 | EGIT_SOURCEDIR="${WORKDIR}/refpolicy";; |
|
|
64 | esac |
|
|
65 | |
|
|
66 | inherit eutils ${extra_eclass} |
| 60 | |
67 | |
| 61 | IUSE="" |
68 | IUSE="" |
| 62 | |
69 | |
| 63 | HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/" |
70 | HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/" |
| 64 | if [[ -n ${BASEPOL} ]]; |
71 | if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "9999" ]]; |
| 65 | then |
72 | then |
| 66 | SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2 |
73 | SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2 |
| 67 | http://dev.gentoo.org/~swift/patches/selinux-base-policy/patchbundle-selinux-base-policy-${BASEPOL}.tar.bz2" |
74 | http://dev.gentoo.org/~swift/patches/selinux-base-policy/patchbundle-selinux-base-policy-${BASEPOL}.tar.bz2" |
|
|
75 | elif [[ "${BASEPOL}" != "9999" ]]; |
|
|
76 | then |
|
|
77 | SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2" |
| 68 | else |
78 | else |
| 69 | SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2" |
79 | SRC_URI="" |
| 70 | fi |
80 | fi |
| 71 | |
81 | |
| 72 | LICENSE="GPL-2" |
82 | LICENSE="GPL-2" |
| 73 | SLOT="0" |
83 | SLOT="0" |
| 74 | S="${WORKDIR}/" |
84 | S="${WORKDIR}/" |
| … | |
… | |
| 99 | # @FUNCTION: selinux-policy-2_src_unpack |
109 | # @FUNCTION: selinux-policy-2_src_unpack |
| 100 | # @DESCRIPTION: |
110 | # @DESCRIPTION: |
| 101 | # Unpack the policy sources as offered by upstream (refpolicy). In case of EAPI |
111 | # Unpack the policy sources as offered by upstream (refpolicy). In case of EAPI |
| 102 | # older than 2, call src_prepare too. |
112 | # older than 2, call src_prepare too. |
| 103 | selinux-policy-2_src_unpack() { |
113 | selinux-policy-2_src_unpack() { |
|
|
114 | if [[ "${BASEPOL}" != "9999" ]]; |
|
|
115 | then |
| 104 | unpack ${A} |
116 | unpack ${A} |
|
|
117 | else |
|
|
118 | git-2_src_unpack |
|
|
119 | fi |
| 105 | |
120 | |
| 106 | # Call src_prepare explicitly for EAPI 0 or 1 |
121 | # Call src_prepare explicitly for EAPI 0 or 1 |
| 107 | has "${EAPI:-0}" 0 1 && selinux-policy-2_src_prepare |
122 | has "${EAPI:-0}" 0 1 && selinux-policy-2_src_prepare |
| 108 | } |
123 | } |
| 109 | |
124 | |
| … | |
… | |
| 125 | |
140 | |
| 126 | # Create 3rd_party location for user-contributed policies |
141 | # Create 3rd_party location for user-contributed policies |
| 127 | cd "${S}/refpolicy/policy/modules" && mkdir 3rd_party; |
142 | cd "${S}/refpolicy/policy/modules" && mkdir 3rd_party; |
| 128 | |
143 | |
| 129 | # Patch the sources with the base patchbundle |
144 | # Patch the sources with the base patchbundle |
| 130 | if [[ -n ${BASEPOL} ]]; |
145 | if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "9999" ]]; |
| 131 | then |
146 | then |
| 132 | cd "${S}" |
147 | cd "${S}" |
| 133 | EPATCH_MULTI_MSG="Applying SELinux policy updates ... " \ |
148 | EPATCH_MULTI_MSG="Applying SELinux policy updates ... " \ |
| 134 | EPATCH_SUFFIX="patch" \ |
149 | EPATCH_SUFFIX="patch" \ |
| 135 | EPATCH_SOURCE="${WORKDIR}" \ |
150 | EPATCH_SOURCE="${WORKDIR}" \ |