Gentoo Archives: gentoo-commits

From: "Sven Vermeulen (swift)" <swift@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sec-policy/selinux-base-policy: selinux-base-policy-2.20120215-r6.ebuild ChangeLog
Date: Sat, 31 Mar 2012 12:39:14
Message-Id: 20120331122914.BC9CC20057@flycatcher.gentoo.org
1 swift 12/03/31 12:29:14
2
3 Modified: ChangeLog
4 Added: selinux-base-policy-2.20120215-r6.ebuild
5 Log:
6 Pushing out 2.20120215 SELinux policies
7
8 (Portage version: 2.1.10.49/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.98 sec-policy/selinux-base-policy/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sec-policy/selinux-base-policy/ChangeLog?rev=1.98&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sec-policy/selinux-base-policy/ChangeLog?rev=1.98&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sec-policy/selinux-base-policy/ChangeLog?r1=1.97&r2=1.98
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sec-policy/selinux-base-policy/ChangeLog,v
20 retrieving revision 1.97
21 retrieving revision 1.98
22 diff -u -r1.97 -r1.98
23 --- ChangeLog 23 Feb 2012 18:43:59 -0000 1.97
24 +++ ChangeLog 31 Mar 2012 12:29:14 -0000 1.98
25 @@ -1,6 +1,11 @@
26 # ChangeLog for sec-policy/selinux-base-policy
27 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-base-policy/ChangeLog,v 1.97 2012/02/23 18:43:59 swift Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-base-policy/ChangeLog,v 1.98 2012/03/31 12:29:14 swift Exp $
30 +
31 +*selinux-base-policy-2.20120215-r6 (31 Mar 2012)
32 +
33 + 31 Mar 2012; <swift@g.o> +selinux-base-policy-2.20120215-r6.ebuild:
34 + Bumping to 2.20120215 policies
35
36 23 Feb 2012; <swift@g.o> selinux-base-policy-2.20110726-r11.ebuild:
37 Stabilizing
38
39
40
41 1.1 sec-policy/selinux-base-policy/selinux-base-policy-2.20120215-r6.ebuild
42
43 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sec-policy/selinux-base-policy/selinux-base-policy-2.20120215-r6.ebuild?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sec-policy/selinux-base-policy/selinux-base-policy-2.20120215-r6.ebuild?rev=1.1&content-type=text/plain
45
46 Index: selinux-base-policy-2.20120215-r6.ebuild
47 ===================================================================
48 # Copyright 1999-2012 Gentoo Foundation
49 # Distributed under the terms of the GNU General Public License v2
50 # $Header: /var/cvsroot/gentoo-x86/sec-policy/selinux-base-policy/selinux-base-policy-2.20120215-r6.ebuild,v 1.1 2012/03/31 12:29:14 swift Exp $
51 EAPI="4"
52
53 HOMEPAGE="http://www.gentoo.org/proj/en/hardened/selinux/"
54 DESCRIPTION="SELinux policy for core modules"
55
56 IUSE=""
57 BASEPOL="2.20120215-r6"
58
59 inherit eutils
60
61 RDEPEND=">=sec-policy/selinux-base-2.20120215-r6"
62 DEPEND=""
63 SRC_URI="http://oss.tresys.com/files/refpolicy/refpolicy-${PV}.tar.bz2
64 http://dev.gentoo.org/~swift/patches/${PN}/patchbundle-${PN}-${BASEPOL}.tar.bz2"
65 KEYWORDS="~amd64 ~x86"
66
67 MODS="application authlogin bootloader clock consoletype cron dmesg fstools getty hostname hotplug init iptables libraries locallogin logging lvm miscfiles modutils mount mta netutils nscd portage raid rsync selinuxutil ssh staff storage su sysadm sysnetwork udev userdomain usermanage unprivuser xdg unconfined"
68 LICENSE="GPL-2"
69 SLOT="0"
70 S="${WORKDIR}/"
71 PATCHBUNDLE="${DISTDIR}/patchbundle-selinux-base-policy-${BASEPOL}.tar.bz2"
72
73 # Code entirely copied from selinux-eclass (cannot inherit due to dependency on
74 # itself), when reworked reinclude it. Only postinstall (where -b base.pp is
75 # added) needs to remain then.
76
77 src_prepare() {
78 local modfiles
79
80 # Patch the sources with the base patchbundle
81 if [[ -n ${BASEPOL} ]];
82 then
83 cd "${S}"
84 EPATCH_MULTI_MSG="Applying SELinux policy updates ... " \
85 EPATCH_SUFFIX="patch" \
86 EPATCH_SOURCE="${WORKDIR}" \
87 EPATCH_FORCE="yes" \
88 epatch
89 fi
90
91 # Apply the additional patches refered to by the module ebuild.
92 # But first some magic to differentiate between bash arrays and strings
93 if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]];
94 then
95 cd "${S}/refpolicy/policy/modules"
96 for POLPATCH in "${POLICY_PATCH[@]}";
97 do
98 epatch "${POLPATCH}"
99 done
100 else
101 if [[ -n ${POLICY_PATCH} ]];
102 then
103 cd "${S}/refpolicy/policy/modules"
104 for POLPATCH in ${POLICY_PATCH};
105 do
106 epatch "${POLPATCH}"
107 done
108 fi
109 fi
110
111 # Collect only those files needed for this particular module
112 for i in ${MODS}; do
113 modfiles="$(find ${S}/refpolicy/policy/modules -iname $i.te) $modfiles"
114 modfiles="$(find ${S}/refpolicy/policy/modules -iname $i.fc) $modfiles"
115 done
116
117 for i in ${POLICY_TYPES}; do
118 mkdir "${S}"/${i} || die "Failed to create directory ${S}/${i}"
119 cp "${S}"/refpolicy/doc/Makefile.example "${S}"/${i}/Makefile \
120 || die "Failed to copy Makefile.example to ${S}/${i}/Makefile"
121
122 cp ${modfiles} "${S}"/${i} \
123 || die "Failed to copy the module files to ${S}/${i}"
124 done
125 }
126
127 src_compile() {
128 for i in ${POLICY_TYPES}; do
129 # Parallel builds are broken, so we need to force -j1 here
130 emake -j1 NAME=$i -C "${S}"/${i} || die "${i} compile failed"
131 done
132 }
133
134 src_install() {
135 local BASEDIR="/usr/share/selinux"
136
137 for i in ${POLICY_TYPES}; do
138 for j in ${MODS}; do
139 einfo "Installing ${i} ${j} policy package"
140 insinto ${BASEDIR}/${i}
141 doins "${S}"/${i}/${j}.pp || die "Failed to add ${j}.pp to ${i}"
142 done
143 done
144 }
145
146 pkg_postinst() {
147 # Override the command from the eclass, we need to load in base as well here
148 local COMMAND
149 for i in ${MODS}; do
150 COMMAND="-i ${i}.pp ${COMMAND}"
151 done
152
153 for i in ${POLICY_TYPES}; do
154 local LOCCOMMAND
155 local LOCMODS
156 if [[ "${i}" != "targeted" ]]; then
157 LOCCOMMAND=$(echo "${COMMAND}" | sed -e 's:-i unconfined.pp::g');
158 LOCMODS=$(echo "${MODS}" | sed -e 's: unconfined::g');
159 else
160 LOCCOMMAND="${COMMAND}"
161 LOCMODS="${MODS}"
162 fi
163 einfo "Inserting the following modules, with base, into the $i module store: ${LOCMODS}"
164
165 cd /usr/share/selinux/${i} || die "Could not enter /usr/share/selinux/${i}"
166
167 semodule -s ${i} -b base.pp ${LOCCOMMAND} || die "Failed to load in base and modules ${LOCMODS} in the $i policy store"
168 done
169 }