# Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 EAPI=6 EGO_PN="github.com/metalmatze/${PN}" inherit golang-vcs-snapshot systemd user DESCRIPTION="Transmission Exporter for Prometheus" HOMEPAGE="https://github.com/metalmatze/transmission-exporter" SRC_URI="https://${EGO_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" RESTRICT="mirror" LICENSE="MIT" SLOT="0" KEYWORDS="~amd64" IUSE="pie" DOCS=( README.md ) QA_PRESTRIPPED="usr/bin/transmission-exporter" G="${WORKDIR}/${P}" S="${G}/src/${EGO_PN}" pkg_setup() { enewgroup transmission-exporter enewuser transmission-exporter -1 -1 -1 transmission-exporter } src_compile() { export GOPATH="${G}" local mygoargs=( -v -work -x "-buildmode=$(usex pie pie default)" -asmflags "-trimpath=${S}" -gcflags "-trimpath=${S}" -ldflags "-s -w" ) go build "${mygoargs[@]}" ./cmd/transmission-exporter || die } src_install() { dobin transmission-exporter einstalldocs newinitd "${FILESDIR}/${PN}.initd" "${PN}" newconfd "${FILESDIR}/${PN}.confd" "${PN}" systemd_dounit "${FILESDIR}/${PN}.service" diropts -m 0750 -o transmission-exporter -g transmission-exporter keepdir /var/log/transmission-exporter }