* [gentoo-commits] repo/gentoo:master commit in: app-admin/logcheck/files/, app-admin/logcheck/
@ 2024-03-10 12:07 Florian Schmaus
0 siblings, 0 replies; only message in thread
From: Florian Schmaus @ 2024-03-10 12:07 UTC (permalink / raw
To: gentoo-commits
commit: d11d9c85d153d60006d44295208dc960da2c78a0
Author: Giuseppe Foti <foti.giuseppe <AT> gmail <DOT> com>
AuthorDate: Thu Mar 7 22:19:52 2024 +0000
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Sun Mar 10 12:06:57 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d11d9c85
app-admin/logcheck: fix cron script and switch sudo to runuser
Includes commits in https://github.com/gentoo/gentoo/pull/35224
- runuser as part of sys-apps/util-linux is much more likely
to be already available
- When using cron, send mail after reboot
- app-admin/logcheck: update HOMEPAGE
Closes: https://github.com/gentoo/gentoo/pull/35681
Closes: https://github.com/gentoo/gentoo/pull/35224
Co-authored-by: Aaron Burnett <aaron <AT> adelie.io>
Signed-off-by: Manuel Mommertz <manuel.mommertz <AT> desy.de>
Signed-off-by: Giuseppe Foti <foti.giuseppe <AT> gmail.com>
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
app-admin/logcheck/files/logcheck-r3.cron | 11 ++++
app-admin/logcheck/files/logcheck.cron.d | 1 +
app-admin/logcheck/logcheck-1.4.3-r3.ebuild | 99 +++++++++++++++++++++++++++++
3 files changed, 111 insertions(+)
diff --git a/app-admin/logcheck/files/logcheck-r3.cron b/app-admin/logcheck/files/logcheck-r3.cron
new file mode 100644
index 000000000000..2ae64f767871
--- /dev/null
+++ b/app-admin/logcheck/files/logcheck-r3.cron
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# To enable sync via cron, execute "runuser -u logcheck touch /etc/logcheck/cron-logcheck-enabled"
+if [[ ! -f /etc/logcheck/cron-logcheck-enabled ]]; then
+ exit
+fi
+if [ ! -d /var/lock/logcheck ]; then
+ mkdir -p /var/lock/logcheck
+ chown logcheck:logcheck /var/lock/logcheck
+fi
+/sbin/runuser -u logcheck --nice -n10 /usr/sbin/logcheck "$@"
diff --git a/app-admin/logcheck/files/logcheck.cron.d b/app-admin/logcheck/files/logcheck.cron.d
new file mode 100644
index 000000000000..bd95c1a95b5c
--- /dev/null
+++ b/app-admin/logcheck/files/logcheck.cron.d
@@ -0,0 +1 @@
+@reboot sleep 60; /etc/cron.hourly/logcheck -R
diff --git a/app-admin/logcheck/logcheck-1.4.3-r3.ebuild b/app-admin/logcheck/logcheck-1.4.3-r3.ebuild
new file mode 100644
index 000000000000..fbc008112833
--- /dev/null
+++ b/app-admin/logcheck/logcheck-1.4.3-r3.ebuild
@@ -0,0 +1,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://packages.debian.org/sid/logcheck"
+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}"-r3.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
+}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-10 12:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-10 12:07 [gentoo-commits] repo/gentoo:master commit in: app-admin/logcheck/files/, app-admin/logcheck/ Florian Schmaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox