Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/darkstat/
Date: Wed, 04 May 2022 04:23:27
Message-Id: 1651637958.210c3f977cf72db1948716e4b7d85c7a5a984b5f.sam@gentoo
1 commit: 210c3f977cf72db1948716e4b7d85c7a5a984b5f
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 4 04:10:31 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed May 4 04:19:18 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=210c3f97
7
8 net-analyzer/darkstat: add error handling; EAPI 8; live template
9
10 - EAPI 8
11 - Add error handling for if chroot directory is empty (don't try to chown /;
12 thankfully no -R option was there)
13 - Use fowners instead of chown to notice missing user earlier (although shouldn't
14 happen)
15 - Use live ebuild template
16
17 Reported-by: Corvus
18 Signed-off-by: Sam James <sam <AT> gentoo.org>
19
20 ...t-9999999.ebuild => darkstat-3.0.719-r4.ebuild} | 46 +++++++++++----------
21 net-analyzer/darkstat/darkstat-9999999.ebuild | 48 ++++++++++++----------
22 2 files changed, 52 insertions(+), 42 deletions(-)
23
24 diff --git a/net-analyzer/darkstat/darkstat-9999999.ebuild b/net-analyzer/darkstat/darkstat-3.0.719-r4.ebuild
25 similarity index 58%
26 copy from net-analyzer/darkstat/darkstat-9999999.ebuild
27 copy to net-analyzer/darkstat/darkstat-3.0.719-r4.ebuild
28 index 4ca39eb748e3..1f62dd3d13c0 100644
29 --- a/net-analyzer/darkstat/darkstat-9999999.ebuild
30 +++ b/net-analyzer/darkstat/darkstat-3.0.719-r4.ebuild
31 @@ -1,32 +1,33 @@
32 -# Copyright 1999-2020 Gentoo Authors
33 +# Copyright 1999-2022 Gentoo Authors
34 # Distributed under the terms of the GNU General Public License v2
35
36 -EAPI=7
37 +EAPI=8
38
39 -inherit autotools git-r3
40 +inherit autotools
41
42 DESCRIPTION="Network traffic analyzer with cute web interface"
43 HOMEPAGE="https://unix4lyfe.org/darkstat/"
44 -EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
45 +if [[ ${PV} == *9999* ]] ; then
46 + EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
47 + inherit git-r3
48 +else
49 + SRC_URI="https://unix4lyfe.org/${PN}/${P}.tar.bz2"
50 + KEYWORDS="~amd64 ~ppc ~x86"
51 +fi
52
53 LICENSE="GPL-2"
54 SLOT="0"
55 -KEYWORDS=""
56
57 -BDEPEND="
58 - app-editors/vim-core
59 -"
60 -DEPEND="
61 - acct-user/darkstat
62 +DEPEND="acct-user/darkstat
63 dev-libs/libbsd
64 net-libs/libpcap
65 - sys-libs/zlib
66 -"
67 -RDEPEND="
68 - ${DEPEND}
69 -"
70 + sys-libs/zlib"
71 +RDEPEND="${DEPEND}"
72 +
73 DARKSTAT_CHROOT_DIR=${DARKSTAT_CHROOT_DIR:-/var/lib/darkstat}
74 +
75 DOCS=( AUTHORS ChangeLog README NEWS )
76 +
77 PATCHES=(
78 "${FILESDIR}"/${PN}-3.0.719-strncpy-off-by-one.patch
79 )
80 @@ -56,21 +57,24 @@ src_install() {
81 sed -i -e "s:__CHROOT__:${DARKSTAT_CHROOT_DIR}:g" "${D}"/etc/init.d/darkstat || die
82
83 keepdir "${DARKSTAT_CHROOT_DIR}"
84 - chown darkstat:0 "${D}${DARKSTAT_CHROOT_DIR}"
85 + fowners darkstat:0 "${DARKSTAT_CHROOT_DIR}"
86 }
87
88 pkg_postinst() {
89 # Workaround bug #141619
90 DARKSTAT_CHROOT_DIR=$(
91 - sed -n 's/^#CHROOT=\(.*\)/\1/p' "${ROOT}"/etc/conf.d/darkstat
92 + sed -n 's/^#CHROOT=\(.*\)/\1/p' "${EROOT}"/etc/conf.d/darkstat
93 )
94 - chown darkstat:0 "${ROOT}${DARKSTAT_CHROOT_DIR}"
95 +
96 + if [[ -n "${DARKSTAT_CHROOT_DIR}" ]] && [[ "${DARKSTAT_CHROOT_DIR}" != "${EROOT:-/}" ]] ; then
97 + chown darkstat:0 "${EROOT}/${DARKSTAT_CHROOT_DIR#/}/"
98 + fi
99
100 elog "To start different darkstat instances which will listen on a different"
101 - elog "interfaces create in /etc/init.d directory the 'darkstat.if' symlink to"
102 + elog "interface, create within the ${EROOT}/etc/init.d directory a 'darkstat.if' symlink to"
103 elog "darkstat script where 'if' is the name of the interface."
104 - elog "Also in /etc/conf.d directory copy darkstat to darkstat.if"
105 + elog "Also in the ${EROOT}/etc/conf.d directory, copy darkstat to darkstat.if"
106 elog "and edit it to change default values."
107 elog
108 - elog "darkstat's default chroot directory is: \"${ROOT}${DARKSTAT_CHROOT_DIR}\""
109 + elog "darkstat's default chroot directory is: ${EROOT}/${DARKSTAT_CHROOT_DIR#/}"
110 }
111
112 diff --git a/net-analyzer/darkstat/darkstat-9999999.ebuild b/net-analyzer/darkstat/darkstat-9999999.ebuild
113 index 4ca39eb748e3..1274c0c32950 100644
114 --- a/net-analyzer/darkstat/darkstat-9999999.ebuild
115 +++ b/net-analyzer/darkstat/darkstat-9999999.ebuild
116 @@ -1,32 +1,35 @@
117 -# Copyright 1999-2020 Gentoo Authors
118 +# Copyright 1999-2022 Gentoo Authors
119 # Distributed under the terms of the GNU General Public License v2
120
121 -EAPI=7
122 +EAPI=8
123
124 -inherit autotools git-r3
125 +inherit autotools
126
127 DESCRIPTION="Network traffic analyzer with cute web interface"
128 HOMEPAGE="https://unix4lyfe.org/darkstat/"
129 -EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
130 +if [[ ${PV} == *9999* ]] ; then
131 + EGIT_REPO_URI="https://www.unix4lyfe.org/git/darkstat"
132 + inherit git-r3
133 +else
134 + SRC_URI="https://unix4lyfe.org/${PN}/${P}.tar.bz2"
135 + KEYWORDS="~amd64 ~ppc ~x86"
136 +fi
137
138 LICENSE="GPL-2"
139 SLOT="0"
140 -KEYWORDS=""
141
142 -BDEPEND="
143 - app-editors/vim-core
144 -"
145 -DEPEND="
146 - acct-user/darkstat
147 +# The live ebuild requires xxd to generate favicon.h.
148 +BDEPEND="app-editors/vim-core"
149 +DEPEND="acct-user/darkstat
150 dev-libs/libbsd
151 net-libs/libpcap
152 - sys-libs/zlib
153 -"
154 -RDEPEND="
155 - ${DEPEND}
156 -"
157 + sys-libs/zlib"
158 +RDEPEND="${DEPEND}"
159 +
160 DARKSTAT_CHROOT_DIR=${DARKSTAT_CHROOT_DIR:-/var/lib/darkstat}
161 +
162 DOCS=( AUTHORS ChangeLog README NEWS )
163 +
164 PATCHES=(
165 "${FILESDIR}"/${PN}-3.0.719-strncpy-off-by-one.patch
166 )
167 @@ -56,21 +59,24 @@ src_install() {
168 sed -i -e "s:__CHROOT__:${DARKSTAT_CHROOT_DIR}:g" "${D}"/etc/init.d/darkstat || die
169
170 keepdir "${DARKSTAT_CHROOT_DIR}"
171 - chown darkstat:0 "${D}${DARKSTAT_CHROOT_DIR}"
172 + fowners darkstat:0 "${DARKSTAT_CHROOT_DIR}"
173 }
174
175 pkg_postinst() {
176 # Workaround bug #141619
177 DARKSTAT_CHROOT_DIR=$(
178 - sed -n 's/^#CHROOT=\(.*\)/\1/p' "${ROOT}"/etc/conf.d/darkstat
179 + sed -n 's/^#CHROOT=\(.*\)/\1/p' "${EROOT}"/etc/conf.d/darkstat
180 )
181 - chown darkstat:0 "${ROOT}${DARKSTAT_CHROOT_DIR}"
182 +
183 + if [[ -n "${DARKSTAT_CHROOT_DIR}" ]] && [[ "${DARKSTAT_CHROOT_DIR}" != "${EROOT:-/}" ]] ; then
184 + chown darkstat:0 "${EROOT}/${DARKSTAT_CHROOT_DIR#/}/"
185 + fi
186
187 elog "To start different darkstat instances which will listen on a different"
188 - elog "interfaces create in /etc/init.d directory the 'darkstat.if' symlink to"
189 + elog "interface, create within the ${EROOT}/etc/init.d directory a 'darkstat.if' symlink to"
190 elog "darkstat script where 'if' is the name of the interface."
191 - elog "Also in /etc/conf.d directory copy darkstat to darkstat.if"
192 + elog "Also in the ${EROOT}/etc/conf.d directory, copy darkstat to darkstat.if"
193 elog "and edit it to change default values."
194 elog
195 - elog "darkstat's default chroot directory is: \"${ROOT}${DARKSTAT_CHROOT_DIR}\""
196 + elog "darkstat's default chroot directory is: ${EROOT}/${DARKSTAT_CHROOT_DIR#/}"
197 }