summaryrefslogtreecommitdiff
blob: 7d4b1f56c3b7ca43c5b7a955df93c3922e565506 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit toolchain-funcs

DESCRIPTION="Automatically monitor system logs and mail security violations"
# Seems that the project has been discontinued by CISCO?
HOMEPAGE="https://sourceforge.net/projects/sentrytools/"
SRC_URI="mirror://gentoo/${P}.tar.gz"
S="${WORKDIR}"/logcheck-${PV}

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 arm ~mips ppc ~s390 sparc x86"

RDEPEND="virtual/mailx"

src_compile() {
	einfo "compile and install mixed in the package makefile"
}

src_install() {
	dodir /usr/bin /var/tmp/logcheck /etc/logcheck

	cp systems/linux/logcheck.sh{,.orig} || die

	sed -i \
		-e 's:/usr/local/bin:/usr/bin:' \
		-e 's:/usr/local/etc:/etc/logcheck:' \
		-e 's:/etc/logcheck/tmp:/var/tmp/logcheck:' \
		systems/linux/logcheck.sh || \
			die "sed logcheck.sh failed"
	sed -i \
		-e "s:/usr/local/bin:${D}/usr/bin:" \
		-e "s:/usr/local/etc:${D}/etc/logcheck:" \
		-e "s:/etc/logcheck/tmp:/var/tmp/logcheck:" \
		-e "s:\$(CC):& \$(LDFLAGS):" \
		Makefile || die "sed Makefile failed"

	emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" linux

	dodoc README* CHANGES CREDITS
	dodoc systems/linux/README.*

	cat << EOF > "${S}"/logsentry.cron || die
#!/bin/sh
#
# Uncomment the following if you want
# logsentry (logcheck) to run hourly
#
# this is part of the logsentry package
#
#

#/bin/sh /etc/logcheck/logcheck.sh
EOF

	exeinto /etc/cron.hourly
	doexe logsentry.cron
}

pkg_postinst() {
	elog
	elog "Uncomment the logcheck line in /etc/cron.hourly/logsentry.cron,"
	elog "or add directly to root's crontab"
	elog
}