# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit go-module systemd COMMIT=110b8cd0a97524bcc9f5f3ac8f4ebbfeba02fdd8 DESCRIPTION="Export smartctl statistics to prometheus" HOMEPAGE="https://github.com/prometheus-community/smartctl_exporter" SRC_URI="https://github.com/prometheus-community/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" SRC_URI+=" https://github.com/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-vendor.tar.xz" LICENSE="Apache-2.0" SLOT="0" KEYWORDS="~amd64 ~riscv ~x86" RDEPEND="sys-apps/smartmontools" BDEPEND=">=dev-lang/go-1.27.0" src_compile() { local go_ldflags=( -X github.com/prometheus/common/version.Version=${PV} -X github.com/prometheus/common/version.Revision=${GIT_COMMIT} -X github.com/prometheus/common/version.Branch=master -X github.com/prometheus/common/version.BuildUser=gentoo -X github.com/prometheus/common/version.BuildDate="$(date +%F-%T)" ) ego build -ldflags "${go_ldflags[*]}" -o ${PN} . } src_test() { ego test ./... } src_install() { dodoc *.md dobin ${PN} newinitd "${FILESDIR}"/${PN}.initd ${PN} newconfd "${FILESDIR}"/${PN}.confd ${PN} systemd_dounit "${FILESDIR}/${PN}.service" }