summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-metrics/prometheus-podman-exporter/prometheus-podman-exporter-9999.ebuild')
-rw-r--r--app-metrics/prometheus-podman-exporter/prometheus-podman-exporter-9999.ebuild48
1 files changed, 46 insertions, 2 deletions
diff --git a/app-metrics/prometheus-podman-exporter/prometheus-podman-exporter-9999.ebuild b/app-metrics/prometheus-podman-exporter/prometheus-podman-exporter-9999.ebuild
index 1547a7a4946d..4452311819fe 100644
--- a/app-metrics/prometheus-podman-exporter/prometheus-podman-exporter-9999.ebuild
+++ b/app-metrics/prometheus-podman-exporter/prometheus-podman-exporter-9999.ebuild
@@ -27,6 +27,38 @@ IUSE="btrfs systemd"
# there are no test files so prevent tests
RESTRICT="test"
+PATCHES=(
+ "${T}/gentoo-specific-systemd-service.patch"
+)
+
+src_prepare() {
+ cat <<-'EOF' > "${T}/gentoo-specific-systemd-service.patch"
+ --- a/contrib/systemd/system/prometheus-podman-exporter.service
+ +++ b/contrib/systemd/system/prometheus-podman-exporter.service
+ @@ -2,7 +2,7 @@
+ Description=Prometheus exporter for podman (v4) machine
+ [Service]
+ Restart=on-failure
+ -EnvironmentFile=-/etc/sysconfig/prometheus-podman-exporter
+ +EnvironmentFile=-/etc/default/prometheus-podman-exporter
+ ExecStart=/usr/bin/prometheus-podman-exporter $PODMAN_EXPORTER_OPTS
+ ExecReload=/bin/kill -HUP $MAINPID
+ TimeoutStopSec=20s
+ --- a/contrib/systemd/user/prometheus-podman-exporter.service
+ +++ b/contrib/systemd/user/prometheus-podman-exporter.service
+ @@ -2,7 +2,7 @@
+ Description=Prometheus exporter for podman (v4) machine
+ [Service]
+ Restart=on-failure
+ -EnvironmentFile=-/etc/sysconfig/prometheus-podman-exporter
+ +EnvironmentFile=-/etc/default/prometheus-podman-exporter
+ EnvironmentFile=-%h/.config/prometheus-podman-exporter
+ ExecStart=/usr/bin/prometheus-podman-exporter $PODMAN_EXPORTER_OPTS
+ ExecReload=/bin/kill -HUP $MAINPID
+ EOF
+ default
+}
+
src_compile() {
export BUILDTAGS="exclude_graphdriver_devicemapper"
use !btrfs && BUILDTAGS+=",exclude_graphdriver_btrfs,btrfs_noversion"
@@ -36,7 +68,19 @@ src_compile() {
src_install() {
emake DESTDIR="${ED}/usr/bin" install
- systemd_dounit "contrib/systemd/prometheus-podman-exporter.service"
- systemd_douserunit "contrib/systemd/prometheus-podman-exporter.service"
+ dosym -r /usr/bin/"${PN}" /usr/bin/podman_exporter
+
+ insinto /etc/default
+ newins "contrib/systemd/system/prometheus-podman-exporter.sysconfig" "${PN}"
+ systemd_dounit "contrib/systemd/system/prometheus-podman-exporter.service"
+ systemd_douserunit "contrib/systemd/user/prometheus-podman-exporter.service"
+ dosym prometheus-podman-exporter.service $(systemd_get_systemunitdir)/podman_exporter.service
+ dosym prometheus-podman-exporter.service $(systemd_get_userunitdir)/podman_exporter.service
+
+ newconfd "contrib/openrc/prometheus-podman-exporter.confd" "${PN}"
+ newinitd "contrib/openrc/prometheus-podman-exporter.initd" "${PN}"
+ dosym "${PN}" /etc/conf.d/podman_exporter
+ dosym "${PN}" /etc/init.d/podman_exporter
+
einstalldocs
}