| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2013 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.15 2012/09/27 16:35:42 axs Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/selinux-policy-2.eclass,v 1.16 2013/01/26 15:01:52 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 |
| … | |
… | |
| 96 | fi |
96 | fi |
| 97 | DEPEND="${RDEPEND} |
97 | DEPEND="${RDEPEND} |
| 98 | sys-devel/m4 |
98 | sys-devel/m4 |
| 99 | >=sys-apps/checkpolicy-2.0.21" |
99 | >=sys-apps/checkpolicy-2.0.21" |
| 100 | |
100 | |
| 101 | SELINUX_EXPF="src_unpack src_compile src_install pkg_postinst" |
101 | SELINUX_EXPF="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
| 102 | case "${EAPI:-0}" in |
102 | case "${EAPI:-0}" in |
| 103 | 2|3|4|5) SELINUX_EXPF+=" src_prepare" ;; |
103 | 2|3|4|5) SELINUX_EXPF+=" src_prepare" ;; |
| 104 | *) ;; |
104 | *) ;; |
| 105 | esac |
105 | esac |
| 106 | |
106 | |
| … | |
… | |
| 279 | einfo "SELinux modules loaded succesfully." |
279 | einfo "SELinux modules loaded succesfully." |
| 280 | fi |
280 | fi |
| 281 | done |
281 | done |
| 282 | } |
282 | } |
| 283 | |
283 | |
|
|
284 | # @FUNCTION: selinux-policy-2_pkg_postrm |
|
|
285 | # @DESCRIPTION: |
|
|
286 | # Uninstall the module(s) from the SELinux policy stores, effectively |
|
|
287 | # deactivating the policy on the system. |
|
|
288 | selinux-policy-2_pkg_postrm() { |
|
|
289 | # Only if we are not upgrading |
|
|
290 | if [[ "${EAPI}" -lt 4 || -z "${REPLACED_BY_VERSION}" ]]; |
|
|
291 | then |
|
|
292 | # build up the command in the case of multiple modules |
|
|
293 | local COMMAND |
|
|
294 | for i in ${MODS}; do |
|
|
295 | COMMAND="-r ${i} ${COMMAND}" |
|
|
296 | done |
|
|
297 | |
|
|
298 | for i in ${POLICY_TYPES}; do |
|
|
299 | einfo "Removing the following modules from the $i module store: ${MODS}" |
|
|
300 | |
|
|
301 | semodule -s ${i} ${COMMAND} |
|
|
302 | if [ $? -ne 0 ]; |
|
|
303 | then |
|
|
304 | ewarn "SELinux module unload failed."; |
|
|
305 | else |
|
|
306 | einfo "SELinux modules unloaded succesfully." |
|
|
307 | fi |
|
|
308 | done |
|
|
309 | fi |
|
|
310 | } |
|
|
311 | |