1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 inherit user golang-build golang-vcs-snapshot systemd
7 EGO_PN="github.com/oliver006/redis_exporter"
8 EGIT_COMMIT="a0d9e4c704b4d35cd08544d395038f417716a03a"
9 ARCHIVE_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
12 DESCRIPTION="Prometheus Exporter for Redis Metrics. Supports Redis 2.x, 3.x and 4.x"
13 HOMEPAGE="https://github.com/oliver006/redis_exporter"
14 SRC_URI="${ARCHIVE_URI}"
21 enewuser ${PN} -1 -1 -1 ${PN}
26 sed -e "s|\(^[[:space:]]*VERSION[[:space:]]*=[[:space:]]*\).*|\1\"${PV}\"|" \
27 -e "s|\(^[[:space:]]*BUILD_DATE[[:space:]]*=[[:space:]]*\).*|\1\"$(LC_ALL=C date -u)\"|" \
28 -e "s|\(^[[:space:]]*COMMIT_SHA1[[:space:]]*=[[:space:]]*\).*|\1\"${EGIT_COMMIT}\"|" \
29 -i src/${EGO_PN}/main.go || die
33 pushd src/${EGO_PN} || die
35 go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
40 dobin bin/redis_exporter
41 dodoc src/${EGO_PN}/README.md
43 for dir in /var/{lib,log}/${PN}; do
45 fowners ${PN}:${PN} "${dir}"
47 newinitd "${FILESDIR}"/${PN}.initd ${PN}
48 newconfd "${FILESDIR}"/${PN}.confd ${PN}
49 insinto /etc/logrotate.d
50 newins "${FILESDIR}/${PN}.logrotated" "${PN}"
51 systemd_dounit "${FILESDIR}/${PN}.service"