summaryrefslogtreecommitdiff
blob: 2714026e100476273d264f175c9224f69d4fc5e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module systemd

# make sure these are updated based on the Makefile in every bump.
GITVERSION=tags/v0.2.7-0-ga173315
SHA=a1733152

DESCRIPTION="prometheus exporter for nftables metrics"
HOMEPAGE="https://github.com/metal-stack/nftables-exporter"
SRC_URI="https://github.com/metal-stack/nftables-exporter/archive/v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://dev.gentoo.org/~williamh/dist/${P}-deps.tar.xz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="net-firewall/nftables"
BDEPEND=">=dev-lang/go-1.21"

src_prepare() {
	default
	sed -i -e '/strip bin\//d' Makefile
}

src_compile() {
	emake \
		GONAME=${PN} \
		GITVERSION=${GITVERSION} \
		SHA=${SHA} \
		VERSION=v${PV} \
		all
}

src_install() {
dobin bin/${PN}
insinto etc
doins nftables_exporter.yaml
systemd_dounit systemd/nftables-exporter.service
newinitd "${FILESDIR}"/${PN}.initd ${PN}
keepdir /var/log/${PN}
}