Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-forensics/lynis/
Date: Thu, 20 Jan 2022 23:52:03
Message-Id: 1642722709.15b16fa6fd962c7278131da9156657287c6880a7.mpagano@gentoo
1 commit: 15b16fa6fd962c7278131da9156657287c6880a7
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 20 23:51:49 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 20 23:51:49 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15b16fa6
7
8 app-forensics/lynis: Do not install cron scripts when not appropiate
9
10 Package-Manager: Portage-3.0.28, Repoman-3.0.3
11 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
12
13 .../{lynis-3.0.7.ebuild => lynis-3.0.7-r1.ebuild} | 29 ++++++++++++++++++----
14 app-forensics/lynis/metadata.xml | 3 +++
15 2 files changed, 27 insertions(+), 5 deletions(-)
16
17 diff --git a/app-forensics/lynis/lynis-3.0.7.ebuild b/app-forensics/lynis/lynis-3.0.7-r1.ebuild
18 similarity index 57%
19 rename from app-forensics/lynis/lynis-3.0.7.ebuild
20 rename to app-forensics/lynis/lynis-3.0.7-r1.ebuild
21 index 6ae259786a48..913dca9f8bb1 100644
22 --- a/app-forensics/lynis/lynis-3.0.7.ebuild
23 +++ b/app-forensics/lynis/lynis-3.0.7-r1.ebuild
24 @@ -12,10 +12,12 @@ SRC_URI="https://cisofy.com/files/${P}.tar.gz"
25 LICENSE="GPL-3"
26 SLOT="0"
27 KEYWORDS="~amd64 ~x86"
28 -IUSE=""
29 +IUSE="cron systemd"
30
31 DEPEND=""
32 -RDEPEND="app-shells/bash"
33 +RDEPEND="
34 + app-shells/bash
35 + !systemd? ( virtual/cron )"
36
37 S="${WORKDIR}/${PN}"
38
39 @@ -44,10 +46,27 @@ src_install() {
40 sed -i -e 's/\/path\/to\///' "${S}/extras/systemd/${PN}.service" || die "Sed Failed!"
41 systemd_dounit "${S}/extras/systemd/${PN}.service" || die "Sed Failed!"
42 systemd_dounit "${S}/extras/systemd/${PN}.timer"
43 +
44 + if ! use cron; then
45 + ebegin "removing cron files from installation image"
46 + rm -rfv "${ED}/etc/cron.daily" || die
47 + eend "$?"
48 + fi
49 }
50
51 pkg_postinst() {
52 - einfo
53 - einfo "A cron script has been installed to ${ROOT}/etc/cron.daily/lynis."
54 - einfo
55 + if use cron; then
56 + if systemd_is_booted || has_version sys-apps/systemd; then
57 + echo
58 + ewarn "Both 'cron' and 'systemd' flags are enabled."
59 + ewarn "So both ${PN}.target and cron files were installed."
60 + ewarn "Please don't use 2 implementations at the same time."
61 + ewarn "Cronjobs are usually enabled by default via /etc/cron.* jobs"
62 + ewarn "If you want to use systemd ${PN}.target timers"
63 + ewarn "disable 'cron' flag and reinstall ${PN}"
64 + echo
65 + else
66 + einfo "A cron script has been installed to ${ROOT}/etc/cron.daily/lynis."
67 + fi
68 + fi
69 }
70
71 diff --git a/app-forensics/lynis/metadata.xml b/app-forensics/lynis/metadata.xml
72 index 086891921a07..72bf02bbb435 100644
73 --- a/app-forensics/lynis/metadata.xml
74 +++ b/app-forensics/lynis/metadata.xml
75 @@ -5,4 +5,7 @@
76 <email>mpagano@g.o</email>
77 <name>Mike Pagano</name>
78 </maintainer>
79 + <use>
80 + <flag name="cron">Install /etc/cron.* files</flag>
81 + </use>
82 </pkgmetadata>