sys-process/audit: Add "daemon" use flag

The use flag enables building audisp, auditd, aureport, ausearch and
probably some other tools. Not sure what's the reason for adding such
a use flag other than disabling the build of the binaries. The daemon
use flag is nowhere set, so these things are not built by default.
This commit is contained in:
Krzesimir Nowak 2020-08-17 22:13:36 +02:00
parent bfc27b3710
commit a1940254ee

View File

@ -28,8 +28,11 @@ LICENSE="GPL-2+ LGPL-2.1+"
SLOT="0" SLOT="0"
# Flatcar: Build amd64 and arm64 by default. # Flatcar: Build amd64 and arm64 by default.
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
IUSE="gssapi ldap python static-libs" # Flatcar: Daemon USE flag for building (or not) auditd and tools.
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" IUSE="daemon gssapi ldap python static-libs"
# Flatcar: Requiring ldap on audit makes sense only if daemon is set.
REQUIRED_USE="ldap? ( daemon )
python? ( ${PYTHON_REQUIRED_USE} )"
# Testcases are pretty useless as they are built for RedHat users/groups and kernels. # Testcases are pretty useless as they are built for RedHat users/groups and kernels.
RESTRICT="test" RESTRICT="test"
@ -76,6 +79,18 @@ src_prepare() {
eapply_user eapply_user
if ! use daemon; then
sed -e '/^SUBDIRS =/s/audisp//' \
-i Makefile.am || die
sed -e '/${DESTDIR}${initdir}/d' \
-e '/${DESTDIR}${legacydir}/d' \
-i init.d/Makefile.am || die
sed -e '/^sbin_PROGRAMS =/s/auditd//' \
-e '/^sbin_PROGRAMS =/s/aureport//' \
-e '/^sbin_PROGRAMS =/s/ausearch//' \
-i src/Makefile.am || die
fi
# Regenerate autotooling # Regenerate autotooling
eautoreconf eautoreconf
} }
@ -172,25 +187,27 @@ multilib_src_install_all() {
dodoc AUTHORS ChangeLog README* THANKS dodoc AUTHORS ChangeLog README* THANKS
docinto contrib docinto contrib
dodoc contrib/{avc_snap,skeleton.c} dodoc contrib/{avc_snap,skeleton.c}
docinto contrib/plugin use daemon && docinto contrib/plugin
dodoc contrib/plugin/* use daemon && dodoc contrib/plugin/*
docinto rules docinto rules
dodoc rules/* dodoc rules/*
newinitd "${FILESDIR}"/auditd-init.d-2.4.3 auditd use daemon && newinitd "${FILESDIR}"/auditd-init.d-2.4.3 auditd
newconfd "${FILESDIR}"/auditd-conf.d-2.1.3 auditd use daemon && newconfd "${FILESDIR}"/auditd-conf.d-2.1.3 auditd
[ -f "${ED}"/sbin/audisp-remote ] && \ if use daemon; then
dodir /usr/sbin && \ [ -f "${ED}"/sbin/audisp-remote ] && \
mv "${ED}"/{sbin,usr/sbin}/audisp-remote || die dodir /usr/sbin && \
mv "${ED}"/{sbin,usr/sbin}/audisp-remote || die
fi
# Gentoo rules # Gentoo rules
insinto /etc/audit/ insinto /etc/audit/
newins "${FILESDIR}"/audit.rules-2.1.3 audit.rules newins "${FILESDIR}"/audit.rules-2.1.3 audit.rules
doins "${FILESDIR}"/audit.rules.stop* use daemon && doins "${FILESDIR}"/audit.rules.stop*
# audit logs go here # audit logs go here
keepdir /var/log/audit/ use daemon && keepdir /var/log/audit/
find "${D}" -name '*.la' -delete || die find "${D}" -name '*.la' -delete || die