# Disable debug rpm on EPEL/CentOS Stream %global debug_package %{nil} # https://github.com/nginxinc/nginx-prometheus-exporter %global goipath github.com/prometheus-community/smartctl_exporter Version: 0.11.0 %gometa %global common_description %{expand: Export smartctl statistics to prometheus} %global golicenses LICENSE Name: smartctl-exporter Release: 1%{?dist} Summary: Export smartctl statistics to prometheus URL: %{gourl} License: LGPL-3.0 Source0: %{gosource} Source1: https://raw.githubusercontent.com/prometheus-community/smartctl_exporter/master/systemd/smartctl_exporter.service Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %description %{common_description} #%%gopkg %prep %autosetup -n smartctl_exporter-%{version} %build go mod vendor CGO_ENABLED=0 go build -buildmode pie -compiler gc '-tags=rpm_crashtraceback' -ldflags '-X %{goipath}/version=%{version} -compressdwarf=false -s -w' -o %{gobuilddir}/bin/%{name} %{goipath} %install install -D -p -m 0755 %{gobuilddir}/bin/%{name} %{buildroot}%{_bindir}/smartctl_exporter install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/systemd/system/%{name}.service %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %license LICENSE %doc README.md CHANGELOG.md %{_bindir}/smartctl_exporter %{_prefix}/lib/systemd/system/%{name}.service