| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/policycoreutils/policycoreutils-2.1.13-r5.ebuild,v 1.1 2012/11/17 16:57:22 swift Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
PYTHON_DEPEND="2:2.7" |
| 7 |
PYTHON_USE_WITH="xml" |
| 8 |
SUPPORT_PYTHON_ABIS="1" |
| 9 |
RESTRICT_PYTHON_ABIS="*-jython *-pypy-* 3.*" |
| 10 |
|
| 11 |
inherit multilib python toolchain-funcs eutils |
| 12 |
|
| 13 |
EXTRAS_VER="1.22" |
| 14 |
SEMNG_VER="2.1.9" |
| 15 |
SELNX_VER="2.1.12" |
| 16 |
SEPOL_VER="2.1.8" |
| 17 |
|
| 18 |
IUSE="audit pam dbus" |
| 19 |
|
| 20 |
DESCRIPTION="SELinux core utilities" |
| 21 |
HOMEPAGE="http://userspace.selinuxproject.org" |
| 22 |
SRC_URI="http://userspace.selinuxproject.org/releases/20120924/${P}.tar.gz |
| 23 |
http://dev.gentoo.org/~swift/patches/policycoreutils/patchbundle-${P}-gentoo-r4.tar.gz |
| 24 |
mirror://gentoo/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" |
| 25 |
|
| 26 |
LICENSE="GPL-2" |
| 27 |
SLOT="0" |
| 28 |
KEYWORDS="amd64 x86" |
| 29 |
|
| 30 |
COMMON_DEPS=">=sys-libs/libselinux-${SELNX_VER}[python] |
| 31 |
>=sys-libs/glibc-2.4 |
| 32 |
>=sys-libs/libcap-1.10-r10 |
| 33 |
>=sys-libs/libsemanage-${SEMNG_VER}[python] |
| 34 |
sys-libs/libcap-ng |
| 35 |
>=sys-libs/libsepol-${SEPOL_VER} |
| 36 |
sys-devel/gettext |
| 37 |
dev-python/ipy |
| 38 |
dbus? ( |
| 39 |
sys-apps/dbus |
| 40 |
dev-libs/dbus-glib |
| 41 |
) |
| 42 |
audit? ( >=sys-process/audit-1.5.1 ) |
| 43 |
pam? ( sys-libs/pam )" |
| 44 |
|
| 45 |
### libcgroup -> seunshare |
| 46 |
### dbus -> restorecond |
| 47 |
|
| 48 |
# pax-utils for scanelf used by rlpkg |
| 49 |
RDEPEND="${COMMON_DEPS} |
| 50 |
dev-python/sepolgen |
| 51 |
app-misc/pax-utils" |
| 52 |
|
| 53 |
DEPEND="${COMMON_DEPS}" |
| 54 |
|
| 55 |
S2=${WORKDIR}/policycoreutils-extra |
| 56 |
|
| 57 |
src_prepare() { |
| 58 |
# rlpkg is more useful than fixfiles |
| 59 |
sed -i -e '/^all/s/fixfiles//' "${S}/scripts/Makefile" \ |
| 60 |
|| die "fixfiles sed 1 failed" |
| 61 |
sed -i -e '/fixfiles/d' "${S}/scripts/Makefile" \ |
| 62 |
|| die "fixfiles sed 2 failed" |
| 63 |
|
| 64 |
EPATCH_MULTI_MSG="Applying policycoreutils patches ... " \ |
| 65 |
EPATCH_SUFFIX="patch" \ |
| 66 |
EPATCH_SOURCE="${WORKDIR}/gentoo-patches" \ |
| 67 |
EPATCH_FORCE="yes" \ |
| 68 |
epatch |
| 69 |
|
| 70 |
# Overwrite gl.po, id.po and et.po with valid PO file |
| 71 |
cp "${S}/po/sq.po" "${S}/po/gl.po" || die "failed to copy ${S}/po/sq.po to gl.po" |
| 72 |
cp "${S}/po/sq.po" "${S}/po/id.po" || die "failed to copy ${S}/po/sq.po to id.po" |
| 73 |
cp "${S}/po/sq.po" "${S}/po/et.po" || die "failed to copy ${S}/po/sq.po to et.po" |
| 74 |
|
| 75 |
epatch_user |
| 76 |
} |
| 77 |
|
| 78 |
src_compile() { |
| 79 |
local use_audit="n"; |
| 80 |
local use_pam="n"; |
| 81 |
local use_dbus="n"; |
| 82 |
local use_sesandbox="n"; |
| 83 |
|
| 84 |
use audit && use_audit="y"; |
| 85 |
use pam && use_pam="y"; |
| 86 |
use dbus && use_dbus="y"; |
| 87 |
|
| 88 |
python_copy_sources semanage sandbox |
| 89 |
building() { |
| 90 |
einfo "Compiling policycoreutils" |
| 91 |
emake -C "${S}" AUDIT_LOG_PRIVS="y" AUDITH="${use_audit}" PAMH="${use_pam}" INOTIFYH="${use_dbus}" SESANDBOX="${use_sesandbox}" CC="$(tc-getCC)" PYLIBVER="python$(python_get_version)" || die |
| 92 |
einfo "Compiling policycoreutils-extra " |
| 93 |
emake -C "${S2}" AUDIT_LOG_PRIVS="y" AUDITH="${use_audit}" PAMH="${use_pam}" INOTIFYH="${use_dbus}" SESANDBOX="${use_sesandbox}" CC="$(tc-getCC)" PYLIBVER="python$(python_get_version)" || die |
| 94 |
} |
| 95 |
python_execute_function -s --source-dir semanage building |
| 96 |
} |
| 97 |
|
| 98 |
src_install() { |
| 99 |
local use_audit="n"; |
| 100 |
local use_pam="n"; |
| 101 |
local use_dbus="n"; |
| 102 |
local use_sesandbox="n"; |
| 103 |
|
| 104 |
use audit && use_audit="y"; |
| 105 |
use pam && use_pam="y"; |
| 106 |
use dbus && use_dbus="y"; |
| 107 |
|
| 108 |
# Python scripts are present in many places. There are no extension modules. |
| 109 |
installation() { |
| 110 |
einfo "Installing policycoreutils" |
| 111 |
emake -C "${S}" DESTDIR="${T}/images/${PYTHON_ABI}" AUDITH="${use_audit}" PAMH="${use_pam}" INOTIFYH="${use_dbus}" SESANDBOX="${use_sesandbox}" AUDIT_LOG_PRIV="y" PYLIBVER="python$(python_get_version)" install || return 1 |
| 112 |
|
| 113 |
einfo "Installing policycoreutils-extra" |
| 114 |
emake -C "${S2}" DESTDIR="${T}/images/${PYTHON_ABI}" SHLIBDIR="${D}$(get_libdir)/rc" install || return 1 |
| 115 |
} |
| 116 |
python_execute_function installation |
| 117 |
python_merge_intermediate_installation_images "${T}/images" |
| 118 |
|
| 119 |
# remove redhat-style init script |
| 120 |
rm -fR "${D}/etc/rc.d" |
| 121 |
|
| 122 |
# compatibility symlinks |
| 123 |
dosym /sbin/setfiles /usr/sbin/setfiles |
| 124 |
dosym /$(get_libdir)/rc/runscript_selinux.so /$(get_libdir)/rcscripts/runscript_selinux.so |
| 125 |
|
| 126 |
# location for permissive definitions |
| 127 |
dodir /var/lib/selinux |
| 128 |
keepdir /var/lib/selinux |
| 129 |
} |
| 130 |
|
| 131 |
pkg_postinst() { |
| 132 |
python_mod_optimize seobject.py |
| 133 |
} |
| 134 |
|
| 135 |
pkg_postrm() { |
| 136 |
python_mod_cleanup seobject.py |
| 137 |
} |