blob: 0cd2197b813f6db7a8f3bcd720c00c4d0f8a96f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit readme.gentoo-r1 systemd tmpfiles
DESCRIPTION="Mails anomalies in the system logfiles to the administrator"
HOMEPAGE="https://logcheck.org/"
SRC_URI="https://salsa.debian.org/debian/logcheck/-/archive/debian/${PV}/logcheck-debian-${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-debian-${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~sparc ~x86"
IUSE="cron systemd"
# Test (emake system-test) requires access to system logs
RESTRICT="test"
DEPEND="
acct-group/logcheck
acct-user/logcheck[systemd?]
"
RDEPEND="
${DEPEND}
!app-admin/logsentry
app-misc/lockfile-progs
dev-lang/perl
dev-perl/mime-construct
virtual/mailx
cron? ( sys-apps/util-linux )
"
DOC_CONTENTS="
Please read the guide at https://wiki.gentoo.org/wiki/Logcheck
for installation instructions.
"
src_prepare() {
default
# Set version from PV, without using dpkg
sed -i -e "s/^VERSION=unknown/VERSION=\"${PV}\"/" "${S}/src/logcheck" || die
# QA-fix remove call to non existent command | Bug: #911281
sed -i "/dpkg-parsechangelog/d" "${S}/Makefile" || die
# Add /var/log/messages to checked logs
echo "/var/log/messages" >> "${S}/etc/logcheck.logfiles.d/syslog.logfiles" || die
# QA-fix Remove install of empty dirs to be created at runtime
sed -i "/install -d \$(DESTDIR)\/var\/lock\/logcheck/d" "${S}/Makefile" || die
# Comment systemd journal check if systemd use flag is not set | Bug: #913857
if ! use systemd; then
sed -i -e "s/^journal/#journal/" "${S}/etc/logcheck.logfiles.d/journal.logfiles" || die
fi
}
src_install() {
default
keepdir /var/lib/logcheck
dodoc docs/README.*
doman docs/logtail.8 docs/logtail2.8
if use cron; then
exeinto /etc/cron.hourly
newexe "${FILESDIR}"/"${PN}"-r4.cron ${PN}
insinto /etc/cron.d
newins "${FILESDIR}"/${PN}.cron.d ${PN}
DOC_CONTENTS="${DOC_CONTENTS}\n
\n
Read /etc/cron.hourly/logcheck.cron to activate hourly cron-based check!\n
\n
To send mail after reboot you should enable the cronjob in /etc/cron.d/logcheck."
fi
if use systemd; then
DOC_CONTENTS="${DOC_CONTENTS}\n
\n
To enable the systemd timer, run the following command:\n
systemctl enable --now logcheck.timer"
fi
systemd_dounit "${FILESDIR}/${PN}."{service,timer}
newtmpfiles "${FILESDIR}/logcheck.tmpfiles" logcheck.conf
readme.gentoo_create_doc
fowners -R logcheck:logcheck /etc/logcheck /var/lib/logcheck
}
pkg_postinst() {
tmpfiles_process logcheck.conf
readme.gentoo_print_elog
}
|