2019-02-09 21:57:21 +03:00
|
|
|
# Copyright 1999-2019 Gentoo Authors
|
2015-06-10 11:04:44 +03:00
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
2016-08-08 09:24:35 +03:00
|
|
|
EAPI="6"
|
2018-12-28 18:45:18 +03:00
|
|
|
PYTHON_COMPAT=( python{3_5,3_6} )
|
2015-06-10 11:04:44 +03:00
|
|
|
PYTHON_REQ_USE="xml"
|
|
|
|
|
2016-08-08 09:24:35 +03:00
|
|
|
inherit multilib python-r1 toolchain-funcs bash-completion-r1
|
2015-06-10 11:04:44 +03:00
|
|
|
|
|
|
|
MY_P="${P//_/-}"
|
|
|
|
|
2019-04-01 08:44:49 +03:00
|
|
|
MY_RELEASEDATE="20190315"
|
2017-06-14 01:05:40 +03:00
|
|
|
EXTRAS_VER="1.36"
|
2015-06-10 11:04:44 +03:00
|
|
|
SEMNG_VER="${PV}"
|
|
|
|
SELNX_VER="${PV}"
|
|
|
|
SEPOL_VER="${PV}"
|
|
|
|
|
|
|
|
IUSE="audit pam dbus"
|
2017-04-21 17:26:19 +03:00
|
|
|
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
|
2015-06-10 11:04:44 +03:00
|
|
|
|
|
|
|
DESCRIPTION="SELinux core utilities"
|
|
|
|
HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
|
|
|
|
|
2018-04-27 20:47:46 +03:00
|
|
|
if [[ ${PV} == 9999 ]]; then
|
2015-06-10 11:04:44 +03:00
|
|
|
inherit git-r3
|
|
|
|
EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
|
2017-06-14 01:05:40 +03:00
|
|
|
SRC_URI="https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2"
|
2015-06-10 11:04:44 +03:00
|
|
|
S1="${WORKDIR}/${MY_P}/${PN}"
|
|
|
|
S2="${WORKDIR}/policycoreutils-extra"
|
2015-07-05 17:08:26 +03:00
|
|
|
S="${S1}"
|
2015-06-10 11:04:44 +03:00
|
|
|
else
|
2019-02-09 21:57:21 +03:00
|
|
|
SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_RELEASEDATE}/${MY_P}.tar.gz
|
2017-06-14 01:05:40 +03:00
|
|
|
https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2"
|
2018-04-27 20:47:46 +03:00
|
|
|
KEYWORDS="~amd64 ~arm64 ~mips ~x86"
|
2015-06-10 11:04:44 +03:00
|
|
|
S1="${WORKDIR}/${MY_P}"
|
|
|
|
S2="${WORKDIR}/policycoreutils-extra"
|
2015-07-05 17:08:26 +03:00
|
|
|
S="${S1}"
|
2015-06-10 11:04:44 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
LICENSE="GPL-2"
|
|
|
|
SLOT="0"
|
|
|
|
|
2017-04-23 15:28:53 +03:00
|
|
|
DEPEND=">=sys-libs/libselinux-${SELNX_VER}:=[python,${PYTHON_USEDEP}]
|
2015-07-05 17:08:26 +03:00
|
|
|
>=sys-libs/libcap-1.10-r10:=
|
2017-04-23 15:28:53 +03:00
|
|
|
>=sys-libs/libsemanage-${SEMNG_VER}:=[python,${PYTHON_USEDEP}]
|
2015-07-05 17:08:26 +03:00
|
|
|
sys-libs/libcap-ng:=
|
|
|
|
>=sys-libs/libsepol-${SEPOL_VER}:=
|
2018-12-28 18:45:18 +03:00
|
|
|
>=app-admin/setools-4.2.0[${PYTHON_USEDEP}]
|
2015-06-10 11:04:44 +03:00
|
|
|
sys-devel/gettext
|
|
|
|
dev-python/ipy[${PYTHON_USEDEP}]
|
|
|
|
dbus? (
|
|
|
|
sys-apps/dbus
|
2015-07-05 17:08:26 +03:00
|
|
|
dev-libs/dbus-glib:=
|
2015-06-10 11:04:44 +03:00
|
|
|
)
|
2017-04-23 15:28:53 +03:00
|
|
|
audit? ( >=sys-process/audit-1.5.1[python,${PYTHON_USEDEP}] )
|
2015-07-05 17:08:26 +03:00
|
|
|
pam? ( sys-libs/pam:= )
|
2017-01-16 01:13:33 +03:00
|
|
|
${PYTHON_DEPS}
|
|
|
|
!<sec-policy/selinux-base-policy-2.20151208-r6"
|
|
|
|
# 2.20151208-r6 and higher has support for new setfiles
|
2015-06-10 11:04:44 +03:00
|
|
|
|
|
|
|
### libcgroup -> seunshare
|
|
|
|
### dbus -> restorecond
|
|
|
|
|
|
|
|
# pax-utils for scanelf used by rlpkg
|
|
|
|
RDEPEND="${DEPEND}
|
2015-07-05 17:08:26 +03:00
|
|
|
app-misc/pax-utils
|
|
|
|
!<sys-apps/openrc-0.14"
|
2015-06-10 11:04:44 +03:00
|
|
|
|
2016-11-20 18:39:29 +03:00
|
|
|
PDEPEND="sys-apps/semodule-utils
|
|
|
|
sys-apps/selinux-python"
|
|
|
|
|
2015-06-10 11:04:44 +03:00
|
|
|
src_unpack() {
|
|
|
|
# Override default one because we need the SRC_URI ones even in case of 9999 ebuilds
|
2015-08-25 22:19:27 +03:00
|
|
|
default
|
2015-06-10 11:04:44 +03:00
|
|
|
if [[ ${PV} == 9999 ]] ; then
|
|
|
|
git-r3_src_unpack
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
src_prepare() {
|
|
|
|
S="${S1}"
|
|
|
|
cd "${S}" || die "Failed to switch to ${S}"
|
|
|
|
if [[ ${PV} != 9999 ]] ; then
|
|
|
|
# If needed for live ebuilds please use /etc/portage/patches
|
2017-04-27 09:06:04 +03:00
|
|
|
eapply "${FILESDIR}/policycoreutils-2.7-0001-newrole-not-suid.patch"
|
2015-06-10 11:04:44 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# rlpkg is more useful than fixfiles
|
|
|
|
sed -i -e '/^all/s/fixfiles//' "${S}/scripts/Makefile" \
|
|
|
|
|| die "fixfiles sed 1 failed"
|
|
|
|
sed -i -e '/fixfiles/d' "${S}/scripts/Makefile" \
|
|
|
|
|| die "fixfiles sed 2 failed"
|
|
|
|
|
2016-08-08 09:24:35 +03:00
|
|
|
eapply_user
|
2015-06-10 11:04:44 +03:00
|
|
|
|
2015-07-05 17:08:26 +03:00
|
|
|
sed -i 's/-Werror//g' "${S1}"/*/Makefile || die "Failed to remove Werror"
|
|
|
|
|
2015-06-10 11:04:44 +03:00
|
|
|
python_copy_sources
|
|
|
|
# Our extra code is outside the regular directory, so set it to the extra
|
|
|
|
# directory. We really should optimize this as it is ugly, but the extra
|
|
|
|
# code is needed for Gentoo at the same time that policycoreutils is present
|
|
|
|
# (so we cannot use an additional package for now).
|
|
|
|
S="${S2}"
|
|
|
|
python_copy_sources
|
|
|
|
}
|
|
|
|
|
|
|
|
src_compile() {
|
|
|
|
building() {
|
|
|
|
emake -C "${BUILD_DIR}" \
|
|
|
|
AUDIT_LOG_PRIVS="y" \
|
2017-04-27 09:06:04 +03:00
|
|
|
AUDITH="$(usex audit y n)" \
|
|
|
|
PAMH="$(usex pam y n)" \
|
|
|
|
INOTIFYH="$(usex dbus y n)" \
|
2015-06-10 11:04:44 +03:00
|
|
|
SESANDBOX="n" \
|
|
|
|
CC="$(tc-getCC)" \
|
|
|
|
LIBDIR="\$(PREFIX)/$(get_libdir)"
|
|
|
|
}
|
|
|
|
S="${S1}" # Regular policycoreutils
|
|
|
|
python_foreach_impl building
|
|
|
|
S="${S2}" # Extra set
|
|
|
|
python_foreach_impl building
|
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
|
|
|
# Python scripts are present in many places. There are no extension modules.
|
|
|
|
installation-policycoreutils() {
|
|
|
|
einfo "Installing policycoreutils"
|
|
|
|
emake -C "${BUILD_DIR}" DESTDIR="${D}" \
|
2018-04-27 20:47:46 +03:00
|
|
|
AUDIT_LOG_PRIVS="y" \
|
2017-04-27 09:06:04 +03:00
|
|
|
AUDITH="$(usex audit y n)" \
|
|
|
|
PAMH="$(usex pam y n)" \
|
|
|
|
INOTIFYH="$(usex dbus y n)" \
|
2015-06-10 11:04:44 +03:00
|
|
|
SESANDBOX="n" \
|
2018-04-27 20:47:46 +03:00
|
|
|
CC="$(tc-getCC)" \
|
2015-06-10 11:04:44 +03:00
|
|
|
LIBDIR="\$(PREFIX)/$(get_libdir)" \
|
|
|
|
install
|
|
|
|
python_optimize
|
|
|
|
}
|
|
|
|
|
|
|
|
installation-extras() {
|
|
|
|
einfo "Installing policycoreutils-extra"
|
2017-02-23 20:53:25 +03:00
|
|
|
emake -C "${BUILD_DIR}" \
|
|
|
|
DESTDIR="${D}" \
|
|
|
|
install
|
2015-06-10 11:04:44 +03:00
|
|
|
python_optimize
|
|
|
|
}
|
|
|
|
|
|
|
|
S="${S1}" # policycoreutils
|
|
|
|
python_foreach_impl installation-policycoreutils
|
|
|
|
S="${S2}" # extras
|
|
|
|
python_foreach_impl installation-extras
|
|
|
|
S="${S1}" # back for later
|
|
|
|
|
|
|
|
# remove redhat-style init script
|
2015-07-05 17:08:26 +03:00
|
|
|
rm -fR "${D}/etc/rc.d" || die
|
2015-06-10 11:04:44 +03:00
|
|
|
|
|
|
|
# compatibility symlinks
|
|
|
|
dosym /sbin/setfiles /usr/sbin/setfiles
|
2015-07-05 17:08:26 +03:00
|
|
|
bashcomp_alias setsebool getsebool
|
2015-06-10 11:04:44 +03:00
|
|
|
|
|
|
|
# location for policy definitions
|
|
|
|
dodir /var/lib/selinux
|
|
|
|
keepdir /var/lib/selinux
|
|
|
|
|
|
|
|
# Set version-specific scripts
|
2017-02-23 20:53:25 +03:00
|
|
|
for pyscript in rlpkg; do
|
2015-06-10 11:04:44 +03:00
|
|
|
python_replicate_script "${ED}/usr/sbin/${pyscript}"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
pkg_postinst() {
|
2015-07-23 10:04:29 +03:00
|
|
|
for POLICY_TYPE in ${POLICY_TYPES} ; do
|
|
|
|
# There have been some changes to the policy store, rebuilding now.
|
|
|
|
# https://marc.info/?l=selinux&m=143757277819717&w=2
|
|
|
|
einfo "Rebuilding store ${POLICY_TYPE} (without re-loading)."
|
|
|
|
semodule -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}"
|
|
|
|
done
|
2015-06-10 11:04:44 +03:00
|
|
|
}
|