# Contributor: Duane Hughes <duanejevon@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=logcheck
pkgver=1.4.3
pkgrel=4
pkgdesc="Bash scripts used to monitor system log files for anomalies"
# !check: Requires writing to root owned paths but can't run as root
options="!check"
url="https://packages.debian.org/source/sid/logcheck"
arch="noarch"
license="GPL-2.0-or-later"
depends="
	bash
	lockfile-progs
	perl
	"
makedepends="docbook2mdoc"
install="$pkgname.pre-install"
subpackages="$pkgname-doc"
pkgusers="logcheck"
source="https://deb.debian.org/debian/pool/main/l/logcheck/logcheck_$pkgver.tar.xz
	run-lock.patch
	busybox-grep.patch
	logcheck.cron.d
	"

build() {
	docbook2mdoc -W -T mdoc docs/logcheck.sgml > docs/logcheck.8 2>/dev/null || true
}

package() {
	make DESTDIR="$pkgdir" install

	install -D -m 644 "$srcdir"/logcheck.cron.d "$pkgdir"/etc/logcheck/logcheck.cron.sample
	chown -R $pkgusers "$pkgdir"/etc/logcheck "$pkgdir"/run/lock/logcheck "$pkgdir"/var/lib/logcheck

	install -D -m 644 -t "$pkgdir"/usr/share/man/man1 docs/*.1
	install -D -m 644 -t "$pkgdir"/usr/share/man/man8 docs/*.8
	install -D -m 644 -t "$pkgdir"/usr/share/doc/"$pkgname" docs/README*

}

sha512sums="
e6c3ef20b44e23099a6b9054f210c8baead6f6a6a84d2d2f0bc465ef95bdf9b267a85f59ec876d1854e0e76f1fb4263a30036caf84b4c8bff15763fb6f9ff6a2  logcheck_1.4.3.tar.xz
543575733f935d6f959a9eaf873dd800846e21f810b4041e6cbf6b64ec8fede2cf9672faeb8b44acbf1c8cd184edb5e44b5aeadb646d65dc93fa60f8d85c48a7  run-lock.patch
08326989174abff26de9917a84fa9811b7db8e23623ce7ab77c19488c3f721491e7954375fbfec3bbe96cff32de7e764b3d8f6b5f9ad3ccc554003bd4205d7ab  busybox-grep.patch
a177388f18c220323eea6f5413f76873e6ad2a2334f58a05727c7b94a793fcb98bd605cefc6fe44aca6afe5c50a9ef851abcc439aefe5b7545d5d6bb584c0a8b  logcheck.cron.d
"
