mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-08 10:52:03 +01:00
eclass/selinux-policy-2: sync with upstream
Signed-off-by: Mathieu Tortuyaux <mathieu@kinvolk.io>
This commit is contained in:
parent
0e286d00c4
commit
da7e024e1f
@ -1,4 +1,4 @@
|
|||||||
# Copyright 1999-2015 Gentoo Foundation
|
# Copyright 1999-2020 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# Eclass for installing SELinux policy, and optionally
|
# Eclass for installing SELinux policy, and optionally
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# @ECLASS: selinux-policy-2.eclass
|
# @ECLASS: selinux-policy-2.eclass
|
||||||
# @MAINTAINER:
|
# @MAINTAINER:
|
||||||
# selinux@gentoo.org
|
# selinux@gentoo.org
|
||||||
# @SUPPORTED_EAPIS: 5 6
|
# @SUPPORTED_EAPIS: 6 7
|
||||||
# @BLURB: This eclass supports the deployment of the various SELinux modules in sec-policy
|
# @BLURB: This eclass supports the deployment of the various SELinux modules in sec-policy
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# The selinux-policy-2.eclass supports deployment of the various SELinux modules
|
# The selinux-policy-2.eclass supports deployment of the various SELinux modules
|
||||||
@ -75,8 +75,8 @@
|
|||||||
: ${SELINUX_GIT_BRANCH:="master"};
|
: ${SELINUX_GIT_BRANCH:="master"};
|
||||||
|
|
||||||
case "${EAPI:-0}" in
|
case "${EAPI:-0}" in
|
||||||
0|1|2|3|4) die "EAPI<5 is not supported";;
|
0|1|2|3|4|5) die "EAPI<6 is not supported";;
|
||||||
5|6) : ;;
|
6|7) : ;;
|
||||||
*) die "unknown EAPI" ;;
|
*) die "unknown EAPI" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -87,10 +87,6 @@ case ${BASEPOL} in
|
|||||||
EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
|
EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ ${EAPI:-0} == 5 ]]; then
|
|
||||||
inherit eutils
|
|
||||||
fi
|
|
||||||
|
|
||||||
IUSE=""
|
IUSE=""
|
||||||
|
|
||||||
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux"
|
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux"
|
||||||
@ -117,9 +113,15 @@ else
|
|||||||
RDEPEND=">=sys-apps/policycoreutils-2.0.82
|
RDEPEND=">=sys-apps/policycoreutils-2.0.82
|
||||||
>=sec-policy/selinux-base-policy-${PV}"
|
>=sec-policy/selinux-base-policy-${PV}"
|
||||||
fi
|
fi
|
||||||
DEPEND="${RDEPEND}
|
if [[ ${EAPI} == 6 ]]; then
|
||||||
sys-devel/m4
|
DEPEND="${RDEPEND}
|
||||||
>=sys-apps/checkpolicy-2.0.21"
|
sys-devel/m4
|
||||||
|
>=sys-apps/checkpolicy-2.0.21"
|
||||||
|
else
|
||||||
|
DEPEND="${RDEPEND}"
|
||||||
|
BDEPEND="sys-devel/m4
|
||||||
|
>=sys-apps/checkpolicy-2.0.21"
|
||||||
|
fi
|
||||||
|
|
||||||
EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm
|
EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm
|
||||||
|
|
||||||
@ -156,25 +158,13 @@ selinux-policy-2_src_prepare() {
|
|||||||
# Patch the sources with the base patchbundle
|
# Patch the sources with the base patchbundle
|
||||||
if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "9999" ]]; then
|
if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "9999" ]]; then
|
||||||
cd "${S}"
|
cd "${S}"
|
||||||
if [[ ${EAPI:-0} == 5 ]]; then
|
einfo "Applying SELinux policy updates ... "
|
||||||
EPATCH_MULTI_MSG="Applying SELinux policy updates ... " \
|
eapply -p0 "${WORKDIR}/0001-full-patch-against-stable-release.patch"
|
||||||
EPATCH_SUFFIX="patch" \
|
|
||||||
EPATCH_SOURCE="${WORKDIR}" \
|
|
||||||
EPATCH_FORCE="yes" \
|
|
||||||
epatch
|
|
||||||
else
|
|
||||||
einfo "Applying SELinux policy updates ... "
|
|
||||||
eapply -p0 "${WORKDIR}/0001-full-patch-against-stable-release.patch"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call in epatch_user. We do this early on as we start moving
|
# Call in eapply_user. We do this early on as we start moving
|
||||||
# files left and right hereafter.
|
# files left and right hereafter.
|
||||||
if [[ ${EAPI:-0} == 5 ]]; then
|
eapply_user
|
||||||
epatch_user
|
|
||||||
else
|
|
||||||
eapply_user
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy additional files to the 3rd_party/ location
|
# Copy additional files to the 3rd_party/ location
|
||||||
if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" == "declare -a"* ]] ||
|
if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" == "declare -a"* ]] ||
|
||||||
@ -189,17 +179,10 @@ selinux-policy-2_src_prepare() {
|
|||||||
|
|
||||||
# Apply the additional patches refered to by the module ebuild.
|
# Apply the additional patches refered to by the module ebuild.
|
||||||
# But first some magic to differentiate between bash arrays and strings
|
# But first some magic to differentiate between bash arrays and strings
|
||||||
if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]] ||
|
if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]]; then
|
||||||
[[ -n ${POLICY_PATCH} ]]; then
|
[[ -n ${POLICY_PATCH[*]} ]] && eapply -d "${S}/refpolicy/policy/modules" "${POLICY_PATCH[@]}"
|
||||||
cd "${S}/refpolicy/policy/modules"
|
else
|
||||||
for POLPATCH in ${POLICY_PATCH[@]};
|
[[ -n ${POLICY_PATCH} ]] && eapply -d "${S}/refpolicy/policy/modules" ${POLICY_PATCH}
|
||||||
do
|
|
||||||
if [[ ${EAPI:-0} == 5 ]]; then
|
|
||||||
epatch "${POLPATCH}"
|
|
||||||
else
|
|
||||||
eapply "${POLPATCH}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect only those files needed for this particular module
|
# Collect only those files needed for this particular module
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user