summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pagano <mpagano@gentoo.org>2022-01-20 18:51:49 -0500
committerMike Pagano <mpagano@gentoo.org>2022-01-20 18:51:49 -0500
commit15b16fa6fd962c7278131da9156657287c6880a7 (patch)
tree58af82d894e60f463c4e0848d99ae8382196ca51 /app-forensics
parentdev-python/stripe: Bump stripe-mock dependency (diff)
downloadgentoo-15b16fa6fd962c7278131da9156657287c6880a7.tar.gz
gentoo-15b16fa6fd962c7278131da9156657287c6880a7.tar.bz2
gentoo-15b16fa6fd962c7278131da9156657287c6880a7.zip
app-forensics/lynis: Do not install cron scripts when not appropiate
Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Mike Pagano <mpagano@gentoo.org>
Diffstat (limited to 'app-forensics')
-rw-r--r--app-forensics/lynis/lynis-3.0.7-r1.ebuild (renamed from app-forensics/lynis/lynis-3.0.7.ebuild)29
-rw-r--r--app-forensics/lynis/metadata.xml3
2 files changed, 27 insertions, 5 deletions
diff --git a/app-forensics/lynis/lynis-3.0.7.ebuild b/app-forensics/lynis/lynis-3.0.7-r1.ebuild
index 6ae259786a48..913dca9f8bb1 100644
--- a/app-forensics/lynis/lynis-3.0.7.ebuild
+++ b/app-forensics/lynis/lynis-3.0.7-r1.ebuild
@@ -12,10 +12,12 @@ SRC_URI="https://cisofy.com/files/${P}.tar.gz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
-IUSE=""
+IUSE="cron systemd"
DEPEND=""
-RDEPEND="app-shells/bash"
+RDEPEND="
+ app-shells/bash
+ !systemd? ( virtual/cron )"
S="${WORKDIR}/${PN}"
@@ -44,10 +46,27 @@ src_install() {
sed -i -e 's/\/path\/to\///' "${S}/extras/systemd/${PN}.service" || die "Sed Failed!"
systemd_dounit "${S}/extras/systemd/${PN}.service" || die "Sed Failed!"
systemd_dounit "${S}/extras/systemd/${PN}.timer"
+
+ if ! use cron; then
+ ebegin "removing cron files from installation image"
+ rm -rfv "${ED}/etc/cron.daily" || die
+ eend "$?"
+ fi
}
pkg_postinst() {
- einfo
- einfo "A cron script has been installed to ${ROOT}/etc/cron.daily/lynis."
- einfo
+ if use cron; then
+ if systemd_is_booted || has_version sys-apps/systemd; then
+ echo
+ ewarn "Both 'cron' and 'systemd' flags are enabled."
+ ewarn "So both ${PN}.target and cron files were installed."
+ ewarn "Please don't use 2 implementations at the same time."
+ ewarn "Cronjobs are usually enabled by default via /etc/cron.* jobs"
+ ewarn "If you want to use systemd ${PN}.target timers"
+ ewarn "disable 'cron' flag and reinstall ${PN}"
+ echo
+ else
+ einfo "A cron script has been installed to ${ROOT}/etc/cron.daily/lynis."
+ fi
+ fi
}
diff --git a/app-forensics/lynis/metadata.xml b/app-forensics/lynis/metadata.xml
index 086891921a07..72bf02bbb435 100644
--- a/app-forensics/lynis/metadata.xml
+++ b/app-forensics/lynis/metadata.xml
@@ -5,4 +5,7 @@
<email>mpagano@gentoo.org</email>
<name>Mike Pagano</name>
</maintainer>
+ <use>
+ <flag name="cron">Install /etc/cron.* files</flag>
+ </use>
</pkgmetadata>