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

EAPI=8

EGIT_REPO_URI="https://github.com/allinurl/${PN}.git"

inherit autotools git-r3 optfeature systemd tmpfiles

DESCRIPTION="A real-time web log analyzer and interactive viewer in a terminal"
HOMEPAGE="https://goaccess.io"
SRC_URI=""

LICENSE="MIT"
SLOT="0"
KEYWORDS=""
IUSE="debug geoip geoipv2 getline ssl unicode"
REQUIRED_USE="geoipv2? ( geoip )"

RDEPEND="acct-group/goaccess
	acct-user/goaccess
	sys-libs/ncurses:=[unicode(+)?]
	geoip? (
		!geoipv2? ( dev-libs/geoip )
		geoipv2? ( dev-libs/libmaxminddb:0= )
	)
	ssl? ( dev-libs/openssl:0= )"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

src_prepare() {
	default

	# Enable log-format, define log file and db path,
	# change path to GeoIP bases in config
	sed -i  -e '/log-format COMBINED/s/#//' \
		-e '/log-file/s/#//' \
		-e '/db-path/s|tmp|var/lib/goaccess|' \
		-e '/geoip-database/s|local/||' config/goaccess.conf \
		|| die "sed failed for goaccess.conf"

	eautoreconf
}

src_configure() {
	local myeconfargs=()
	readarray -t myeconfargs < <(
		use_enable debug
		use_enable geoip geoip "$(usex geoipv2 mmdb legacy)"
		use_enable unicode utf8
		use_with getline
		use_with ssl openssl
	)
	econf "${myeconfargs[@]}"
}

src_install() {
	default

	newinitd "${FILESDIR}"/goaccess.initd goaccess
	newconfd "${FILESDIR}"/goaccess.confd goaccess
	systemd_dounit "${FILESDIR}"/goaccess.service
	newtmpfiles "${FILESDIR}"/goaccess.tmpfile goaccess.conf

	diropts -o goaccess -g goaccess -m 0700
	keepdir /var/lib/goaccess/db /var/log/goaccess
}

pkg_postinst() {
	optfeature "update GeoIP databases" net-misc/geoipupdate
	tmpfiles_process goaccess.conf
}