Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 274779
Collapse All | Expand All

(-)file_not_specified_in_diff (-29 / +62 lines)
Line  Link Here
0
-- vnstat-1.7-r1.ebuild
0
++ vnstat-1.7-r2.ebuild
Lines 1-6 Link Here
1
# Copyright 1999-2009 Gentoo Foundation
1
# Copyright 1999-2009 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/vnstat/vnstat-1.7-r1.ebuild,v 1.1 2009/04/26 19:56:03 patrick Exp $
3
# $Header: $
4
4
5
EAPI="2"
5
EAPI="2"
6
6
Lines 20-28 Link Here
20
RDEPEND="${DEPEND}
20
RDEPEND="${DEPEND}
21
	virtual/cron"
21
	virtual/cron"
22
22
23
pkg_setup() {
24
	enewgroup vnstat
25
	enewuser vnstat -1 -1 /dev/null vnstat
26
}
27
23
src_compile() {
28
src_compile() {
29
	sed -i 's/vnstat\.log/vnstatd\.log/' cfg/vnstat.conf
30
	sed -i 's/vnstat\.pid/vnstatd\/vnstatd\.pid/' cfg/vnstat.conf
31
24
	if use gd; then
32
	if use gd; then
25
		emake all CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake failed"
33
		emake all CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake all failed"
26
	else
34
	else
27
		emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake failed"
35
		emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}" || die "emake failed"
28
	fi
36
	fi
Lines 30-85 Link Here
30
38
31
src_install() {
39
src_install() {
32
	if use gd; then
40
	if use gd; then
33
		dobin src/vnstati || die "dobin failed"
41
		dobin src/vnstati || die "vnstati dobin failed"
34
	fi
42
	fi
35
	dobin src/vnstat src/vnstatd || die "dobin failed"
43
	dobin src/vnstat src/vnstatd || die "dobin failed"
36
	exeinto /etc/cron.hourly
37
	newexe "${FILESDIR}"/vnstat.cron vnstat
38
44
39
	insinto /etc
45
	insinto /etc
40
	doins cfg/vnstat.conf
46
	doins cfg/vnstat.conf
47
	fowners root:vnstat /etc/vnstat.conf
41
48
42
	if use gd; then
49
	insinto /etc/cron.d
43
		doman man/vnstati.1
50
	newins "${FILESDIR}"/vnstat.crontab vnstat
44
	fi
51
45
	doman man/vnstat.1 man/vnstatd.1
52
	newconfd "${FILESDIR}"/vnstatd.confd vnstatd
53
	newinitd "${FILESDIR}"/vnstatd.initd vnstatd
46
54
47
	keepdir /var/lib/vnstat
55
	keepdir /var/lib/vnstat
56
	fowners vnstat:vnstat /var/lib/vnstat
48
57
49
	newdoc pppd/vnstat_ip-up ip-up.example
58
	keepdir /var/run/vnstatd
50
	newdoc pppd/vnstat_ip-down ip-down.example
59
	fowners vnstat:vnstat /var/run/vnstatd
51
	dodoc CHANGES README UPGRADE FAQ
60
61
	use gd && doman man/vnstati.1
62
	doman man/vnstat.1 man/vnstatd.1
63
64
	newdoc examples/vnstat_ip-up ip-up.example
65
	newdoc examples/vnstat_ip-down ip-down.example
66
	dodoc CHANGES README UPGRADE FAQ examples/vnstat.cgi
52
	newdoc INSTALL README.setup
67
	newdoc INSTALL README.setup
53
}
68
}
54
69
55
pkg_postinst() {
70
pkg_postinst() {
56
	# compatibility for 1.1 ebuild
71
	# compat for 1.1 ebuild
57
	if [[ -d ${ROOT}/var/spool/vnstat ]] ; then
72
	if [[ -d "${ROOT}"/var/spool/vnstat ]]; then
58
		mv -f "${ROOT}"/var/spool/vnstat/* "${ROOT}"/var/lib/vnstat/ \
73
		mv -f "${ROOT}"/var/spool/vnstat/* "${ROOT}"/var/lib/vnstat/ \
59
			&& rmdir "${ROOT}"/var/spool/vnstat
74
			&& rmdir "${ROOT}"/var/spool/vnstat
60
		elog "vnStat db files moved from /var/spool/vnstat to /var/lib/vnstat"
75
		ewarn
61
		elog
76
		ewarn "vnStat db files have been moved from /var/spool/vnstat to /var/lib/vnstat"
77
	fi
78
79
	# compat for <1.7-r2 ebuilds
80
	[[ -d "${ROOT}"/var/lib/vnstat ]] && chown vnstat:vnstat "${ROOT}"/var/lib/vnstat
81
	if [[ `ls -oAI.keep_"${CATEGORY}"* "${ROOT}"/var/lib/vnstat/ \
82
		| egrep -v "^total|.* vnstat .*" | wc -l` -gt 0 ]]
83
	then
84
		find "${ROOT}"/var/lib/vnstat/ -type f -a ! -name .keep_"${CATEGORY}"\* \
85
			-exec chown vnstat:vnstat {} +
86
		ewarn
87
		ewarn "vnStat db files owning user and group has been changed to \"vnstat\"."
62
	fi
88
	fi
63
89
64
	elog "Repeat the following command for every interface you"
90
	elog
65
	elog "wish to monitor (replace eth0):"
91
	elog "Repeat the following commands for every interface that"
92
	elog "is to be monitored (replace eth0):"
66
	elog "   vnstat -u -i eth0"
93
	elog "   vnstat -u -i eth0"
94
	elog "   chown vnstat:vnstat /var/lib/vnstat/eth0"
67
	elog
95
	elog
68
	elog "Note: if an interface transfers more than ~4GB in"
96
	elog "An init script for vnstatd has been installed to /etc/init.d/vnstatd."
69
	elog "the time between cron runs, you may miss traffic"
70
	elog
97
	elog
71
98
72
	if [[ -e ${ROOT}/etc/cron.d/vnstat ]] ; then
99
	if [[ -e "${ROOT}"/etc/cron.hourly/vnstat ]]; then
73
		elog "vnstat's cron script is now installed as /etc/cron.hourly/vnstat."
100
		elog "vnstat's cron script is now installed as /etc/cron.d/vnstat."
74
		elog "Please remove /etc/cron.d/vnstat."
101
		elog "Please remove /etc/cron.hourly/vnstat."
75
		elog
102
		elog
76
	else
103
	else
77
		elog "A cron script has been installed to /etc/cron.hourly/vnstat."
104
		elog "A cron script has been installed to /etc/cron.d/vnstat."
78
		elog
105
		elog
79
	fi
106
	fi
80
	elog "To update your interface database automatically with"
107
	elog "To update the interface database automatically using"
81
	elog "cron, uncomment the lines in /etc/cron.hourly/vnstat."
108
	elog "cron, uncomment the lines in /etc/cron.d/vnstat."
109
	elog
110
	ewarn "NOTE: If an interface transfers more than ~4GB in"
111
	ewarn "the time between cron runs, vnstat may miss traffic."
112
	elog
113
114
	elog "Starting with version 1.5, the --dbdir option is dropped."
115
	elog "One can set the database directory using the \"DatabaseDir\""
116
	elog "directive in the configuration file (/etc/vnstat.conf)."
82
	elog
117
	elog
83
	elog "Starting with version 1.5 --dbdir option is droped. You can do the same"
84
	elog "with DatabaseDir directive in configuration file (/etc/vnstat.conf)."
85
}
118
}

Return to bug 274779