You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.4 KiB
73 lines
1.4 KiB
# Copyright 1999-2019 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=6
|
|
inherit toolchain-funcs user
|
|
|
|
DESCRIPTION="Console-based network traffic monitor that keeps statistics of network usage"
|
|
HOMEPAGE="https://humdi.net/vnstat/"
|
|
SRC_URI="https://humdi.net/vnstat/${P}.tar.gz"
|
|
|
|
LICENSE="GPL-2"
|
|
SLOT="0"
|
|
KEYWORDS="amd64 arm hppa ppc ppc64 sparc x86"
|
|
IUSE="gd selinux test"
|
|
RESTRICT="!test? ( test )"
|
|
|
|
COMMON_DEPEND="
|
|
gd? ( media-libs/gd[png] )
|
|
"
|
|
DEPEND="
|
|
${COMMON_DEPEND}
|
|
test? ( dev-libs/check )
|
|
"
|
|
RDEPEND="
|
|
${COMMON_DEPEND}
|
|
selinux? ( sec-policy/selinux-vnstatd )
|
|
"
|
|
|
|
pkg_setup() {
|
|
enewgroup vnstat
|
|
enewuser vnstat -1 -1 /dev/null vnstat
|
|
}
|
|
|
|
src_prepare() {
|
|
default
|
|
|
|
tc-export CC
|
|
|
|
sed -i \
|
|
-e 's|vnstat[.]log|vnstatd.log|' \
|
|
-e 's|vnstat[.]pid|vnstatd/vnstatd.pid|' \
|
|
-e 's|/var/run|/run|' \
|
|
cfg/${PN}.conf || die
|
|
sed -i \
|
|
-e '/PIDFILE/s|/var/run|/run|' \
|
|
src/common.h || die
|
|
}
|
|
|
|
src_compile() {
|
|
emake ${PN} ${PN}d $(usex gd ${PN}i '')
|
|
}
|
|
|
|
src_install() {
|
|
use gd && dobin vnstati
|
|
dobin vnstat vnstatd
|
|
|
|
exeinto /etc/cron.hourly
|
|
newexe "${FILESDIR}"/vnstat.cron vnstat
|
|
|
|
insinto /etc
|
|
doins cfg/vnstat.conf
|
|
fowners root:vnstat /etc/vnstat.conf
|
|
|
|
newconfd "${FILESDIR}"/vnstatd.confd vnstatd
|
|
newinitd "${FILESDIR}"/vnstatd.initd-r1 vnstatd
|
|
|
|
use gd && doman man/vnstati.1
|
|
doman man/vnstat.1 man/vnstatd.1
|
|
|
|
newdoc INSTALL README.setup
|
|
dodoc CHANGES README UPGRADE FAQ examples/vnstat.cgi
|
|
}
|