Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/smokeping/, net-analyzer/smokeping/files/
Date: Thu, 08 Feb 2018 19:44:37
Message-Id: 1518119072.d610d25991c7d3f5309d0c6f04ba98498fef05c1.jer@gentoo
1 commit: d610d25991c7d3f5309d0c6f04ba98498fef05c1
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 8 19:39:42 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 8 19:44:32 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d610d259
7
8 net-analyzer/smokeping: Version 2.7.1.
9
10 Package-Manager: Portage-2.3.19, Repoman-2.3.6
11
12 net-analyzer/smokeping/Manifest | 1 +
13 net-analyzer/smokeping/files/smokeping.init.5 | 56 ++++++++++
14 net-analyzer/smokeping/smokeping-2.7.1.ebuild | 147 ++++++++++++++++++++++++++
15 3 files changed, 204 insertions(+)
16
17 diff --git a/net-analyzer/smokeping/Manifest b/net-analyzer/smokeping/Manifest
18 index 27b1f05ca28..7502e5dc1a6 100644
19 --- a/net-analyzer/smokeping/Manifest
20 +++ b/net-analyzer/smokeping/Manifest
21 @@ -1,3 +1,4 @@
22 DIST smokeping-2.6.11.tar.gz 417338 BLAKE2B e1ff2fc05fd8d39f42e1cc89831aa36ef0522716d1768dba9bdedf09f6c64cc2b35f30c3b727959dd93ed8922235729a27c85acceb1e1c3ec9c5f60e21455ab9 SHA512 928722832d6e01ffbb7b74542678f7b9d5fc22819c0feae164ce58b8d8a5595800f617c8a672e07cae4b2c4ccbfa4883a11438ba2a172fc2887abc2933388422
23 DIST smokeping-2.6.9.tar.gz 427185 BLAKE2B 3b626d852542f5e9e616ce88a8fd2fd773036822f10f548a1cec242f5d420ec67d940ee49c08da99f7e0815921251cb474b103c8c12c364f90651a4e74e9abf3 SHA512 ab3cec15fd9f90510f902da7ce5bac5915558cac198cc88f0ce193a53a0158c9055e28c8c6671cc6653ac42ab51346e1eb19e537f1ab5c234fd498c6b777499d
24 DIST smokeping-2.7.0.tar.gz 8914621 BLAKE2B a139fdcaafe37c61695ea2e31e3ddaeb4389f754f28fd41318db120f2ae5f4b5f355ebfb5e0c852b48e2e6872194952bc3733ff5f6bcd2886859a1c276835121 SHA512 17ada10e2cdc7966e81e589dec603fe77bc0a273790734b36342ff2b8ac3d5bca6797f6eb95a6e2e22a576b7bb5d2ca4232b4fb23057b360de9c156d141ed0ca
25 +DIST smokeping-2.7.1.tar.gz 8919251 BLAKE2B 91f348b573d5a7ce98e8b51c96d9f45bb0af21cae4b049ba113bfc97c60800d8fdea0c05eb5414ec861f07f30170abf64ee34e0e29899528c01283ddab0ecde8 SHA512 c7208a40725e5694813a0545d6f8b663bab49739fe716bed5fd85ed6258c1c0abde4a18a0678988fff067ecc7807c83313abf12c04b935377b0b7158f07d8626
26
27 diff --git a/net-analyzer/smokeping/files/smokeping.init.5 b/net-analyzer/smokeping/files/smokeping.init.5
28 new file mode 100644
29 index 00000000000..3c08c3fdc65
30 --- /dev/null
31 +++ b/net-analyzer/smokeping/files/smokeping.init.5
32 @@ -0,0 +1,56 @@
33 +#!/sbin/openrc-run
34 +# Copyright 1999-2018 Gentoo Foundation
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +command="/usr/bin/smokeping"
38 +command_args="--nodaemon"
39 +command_background="true"
40 +command_user="smokeping:smokeping"
41 +pidfile="/run/${RC_SVCNAME}.pid"
42 +extra_started_commands="dump reload restore"
43 +required_files="/etc/smokeping/config"
44 +
45 +depend() {
46 + need net
47 + use dns
48 +}
49 +
50 +start_pre() {
51 + export LC_ALL=C
52 +}
53 +
54 +reload() {
55 + ebegin "Reloading smokeping"
56 + "${command}" --reload 2>&1 >/dev/null
57 + eend $?
58 +}
59 +
60 +dump() {
61 + ebegin "Dumping smokeping rrd files to XML for backup or upgrade use"
62 + if service_started "${myservice}" ; then
63 + eerror "You need to stop smokeping before dumping files!"
64 + return 1
65 + fi
66 + for f in $(find /var/lib/smokeping -name '*.rrd' -print) ; do
67 + f_xml=$(dirname $f)/$(basename $f .rrd).xml
68 + rrdtool dump "$f" > "${f_xml}"
69 + chown root:0 "${f_xml}"
70 + done
71 + eend $?
72 +}
73 +
74 +restore() {
75 + ebegin "Restoring smokeping rrd files from XML dump files"
76 + if service_started "${myservice}" ; then
77 + eerror "You need to stop smokeping before restoring files!"
78 + return 1
79 + fi
80 + for f in $(find /var/lib/smokeping -name '*.xml' -print) ; do
81 + f_rrd=$(dirname $f)/$(basename $f .xml).rrd
82 + mv -f "${f_rrd}" "${f_rrd}.bak"
83 + chown root:0 "${f_rrd}.bak"
84 + rrdtool restore "$f" "${f_rrd}"
85 + chown smokeping:smokeping "${f_rrd}"
86 + done
87 + eend $?
88 +}
89
90 diff --git a/net-analyzer/smokeping/smokeping-2.7.1.ebuild b/net-analyzer/smokeping/smokeping-2.7.1.ebuild
91 new file mode 100644
92 index 00000000000..7f9baf701fe
93 --- /dev/null
94 +++ b/net-analyzer/smokeping/smokeping-2.7.1.ebuild
95 @@ -0,0 +1,147 @@
96 +# Copyright 1999-2018 Gentoo Foundation
97 +# Distributed under the terms of the GNU General Public License v2
98 +
99 +EAPI=6
100 +inherit autotools eutils multilib user systemd
101 +
102 +DESCRIPTION="A powerful latency measurement tool"
103 +HOMEPAGE="http://oss.oetiker.ch/smokeping/"
104 +SRC_URI="http://oss.oetiker.ch/smokeping/pub/${P}.tar.gz"
105 +
106 +LICENSE="GPL-2"
107 +SLOT="0"
108 +KEYWORDS="~amd64 ~x86"
109 +
110 +IUSE="apache2 curl dig echoping ipv6 radius"
111 +
112 +DEPEND="
113 + >=dev-lang/perl-5.8.8-r8
114 + >=dev-perl/SNMP_Session-1.13
115 + >=net-analyzer/fping-2.4_beta2-r2[suid]
116 + >=net-analyzer/rrdtool-1.2[graph,perl]
117 + dev-perl/CGI
118 + dev-perl/CGI-Session
119 + dev-perl/Config-Grammar
120 + dev-perl/Digest-HMAC
121 + dev-perl/FCGI
122 + dev-perl/IO-Socket-SSL
123 + dev-perl/IO-Tty
124 + dev-perl/Net-DNS
125 + dev-perl/Net-OpenSSH
126 + dev-perl/Net-SNMP
127 + dev-perl/Net-Telnet
128 + dev-perl/libwww-perl
129 + dev-perl/perl-ldap
130 + virtual/perl-libnet
131 + || ( dev-perl/CGI-Fast <dev-perl/CGI-4 )
132 + !apache2? ( virtual/httpd-cgi )
133 + apache2? (
134 + >=www-apache/mod_perl-2.0.1
135 + www-apache/mod_fcgid
136 + )
137 + curl? ( >=net-misc/curl-7.21.4 )
138 + dig? ( net-dns/bind-tools )
139 + echoping? ( >=net-analyzer/echoping-6.0.2 )
140 + ipv6? ( >=dev-perl/Socket6-0.20 )
141 + radius? ( dev-perl/Authen-Radius )
142 +"
143 +
144 +RDEPEND="${DEPEND}"
145 +
146 +pkg_setup() {
147 + enewgroup smokeping
148 + enewuser smokeping -1 -1 /var/lib/smokeping smokeping
149 +}
150 +
151 +src_prepare() {
152 + default
153 +
154 + sed -i -e '/^SUBDIRS = / s|thirdparty||g' Makefile.am || die
155 + sed -i -e '/^perllibdir = / s|= .*|= $(libdir)|g' lib/Makefile.am || die
156 + rm -r lib/{BER.pm,SNMP_Session.pm,SNMP_util.pm} || die # dev-perl/SNMP_Session
157 + echo ${PV} > VERSION
158 +
159 + eautoreconf
160 +}
161 +
162 +src_configure() {
163 + econf \
164 + --sysconfdir=/etc/smokeping \
165 + --with-htdocs-dir=/var/www/localhost/smokeping
166 +}
167 +
168 +src_compile() {
169 + LC_ALL=C emake
170 +}
171 +
172 +src_install() {
173 + dodir /usr/$(get_libdir)
174 + default
175 +
176 + newinitd "${FILESDIR}"/${PN}.init.5 ${PN}
177 + systemd_dotmpfilesd "${FILESDIR}"/"${PN}".conf
178 + systemd_dounit "${FILESDIR}"/"${PN}".service
179 +
180 + mv "${D}/etc/smokeping/basepage.html.dist" "${D}/etc/smokeping/basepage.html"
181 + mv "${D}/etc/smokeping/config.dist" "${D}/etc/smokeping/config"
182 + mv "${D}/etc/smokeping/smokemail.dist" "${D}/etc/smokeping/smokemail"
183 + mv "${D}/etc/smokeping/smokeping_secrets.dist" "${D}/etc/smokeping/smokeping_secrets"
184 + mv "${D}/etc/smokeping/tmail.dist" "${D}/etc/smokeping/tmail"
185 +
186 + sed -i \
187 + -e '/^imgcache/{s:\(^imgcache[ \t]*=\).*:\1 /var/lib/smokeping/.simg:}' \
188 + -e '/^imgurl/{s:\(^imgurl[ \t]*=\).*:\1 ../.simg:}' \
189 + -e '/^datadir/{s:\(^datadir[ \t]*=\).*:\1 /var/lib/smokeping:}' \
190 + -e '/^piddir/{s:\(^piddir[ \t]*=\).*:\1 /run/smokeping:}' \
191 + -e '/^cgiurl/{s#\(^cgiurl[ \t]*=\).*#\1 http://some.place.xyz/perl/smokeping.pl#}' \
192 + -e '/^smokemail/{s:\(^smokemail[ \t]*=\).*:\1 /etc/smokeping/smokemail:}' \
193 + -e '/^tmail/{s:\(^tmail[ \t]*=\).*:\1 /etc/smokeping/tmail:}' \
194 + -e '/^secrets/{s:\(^secrets[ \t]*=\).*:\1 /etc/smokeping/smokeping_secrets:}' \
195 + -e '/^template/{s:\(^template[ \t]*=\).*:\1 /etc/smokeping/basepage.html:}' \
196 + "${D}/etc/${PN}/config" || die
197 +
198 + sed -i \
199 + -e '/^<script/{s:cropper/:/cropper/:}' \
200 + "${D}/etc/${PN}/basepage.html" || die
201 +
202 + sed -i \
203 + -e 's/$FindBin::Bin\/..\/etc\/config/\/etc\/smokeping\/config/g' \
204 + "${D}/usr/bin/smokeping" "${D}/usr/bin/smokeping_cgi" || die
205 +
206 + sed -i \
207 + -e 's:etc/config.dist:/etc/smokeping/config:' \
208 + "${D}/usr/bin/tSmoke" || die
209 +
210 + sed -i \
211 + -e 's:/usr/etc/config:/etc/smokeping/config:' \
212 + "${D}/var/www/localhost/smokeping/smokeping.fcgi.dist" || die
213 +
214 + dodir /var/www/localhost/cgi-bin
215 + mv "${D}/var/www/localhost/smokeping/smokeping.fcgi.dist" \
216 + "${D}/var/www/localhost/cgi-bin/smokeping.fcgi"
217 +
218 + fperms 700 /etc/${PN}/smokeping_secrets
219 +
220 + if use apache2 ; then
221 + insinto /etc/apache2/modules.d
222 + doins "${FILESDIR}/79_${PN}.conf"
223 + fi
224 +
225 + # Create the files in /var for rrd file storage
226 + keepdir /var/lib/${PN}/.simg
227 + fowners smokeping:smokeping /var/lib/${PN}
228 +
229 + if use apache2 ; then
230 + fowners apache:apache /var/lib/${PN}/.simg
231 + fowners -R apache:apache /var/www
232 + else
233 + fowners smokeping:smokeping /var/lib/${PN}/.simg
234 + fi
235 +
236 + fperms 775 /var/lib/${PN} /var/lib/${PN}/.simg
237 +}
238 +
239 +pkg_postinst() {
240 + chown smokeping:smokeping "${ROOT}/var/lib/${PN}"
241 + chmod 755 "${ROOT}/var/lib/${PN}"
242 +}