# Generated by go2rpm 1.8.0 %bcond_without check %global shortname druggeri-nut-exporter # https://github.com/DRuggeri/nut_exporter %global goipath github.com/DRuggeri/nut_exporter # >=3.0.0 bumps the prometheus/exporter-toolkit dependency to >=0.8.0, which # Fedora does not yet have. For now, just run an older version. Version: 2.5.3 %gometa -f %global common_description Network UPS Tools Prometheus Exporter. %global golicenses LICENSE %global godocs README.md Name: %{goname} Release: %autorelease Summary: Network UPS Tools Prometheus Exporter License: Apache-2.0 URL: %{gourl} Source0: %{gosource} Source1: %{shortname}.conf Source2: %{shortname}.service Source3: %{shortname}.sysusers BuildRequires: golang(github.com/go-kit/log) BuildRequires: golang(github.com/go-kit/log/level) BuildRequires: golang(github.com/prometheus/client_golang/prometheus) BuildRequires: golang(github.com/prometheus/client_golang/prometheus/promhttp) BuildRequires: golang(github.com/prometheus/common/promlog) BuildRequires: golang(github.com/prometheus/common/promlog/flag) BuildRequires: golang(github.com/prometheus/common/version) BuildRequires: golang(github.com/robbiet480/go.nut) BuildRequires: golang(gopkg.in/alecthomas/kingpin.v2) BuildRequires: systemd-rpm-macros Requires(pre): shadow-utils %description %{common_description} %gopkg %prep %goprep %generate_buildrequires %go_generate_buildrequires %build %gobuild -o %{gobuilddir}/bin/nut_exporter %{goipath} %install %gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ mv %{buildroot}%{_bindir}/nut_exporter %{buildroot}%{_bindir}/%{shortname} install -Dpm 0644 %{S:1} %{buildroot}%{_sysconfdir}/default/%{shortname} install -Dpm 0644 %{S:2} %{buildroot}%{_unitdir}/%{shortname}.service install -Dpm 0644 %{S:3} %{buildroot}%{_sysusersdir}/%{shortname}.conf %if %{with check} %check %gocheck %endif %pre %sysusers_create_compat %{S:3} %post %systemd_post %{shortname}.service %preun %systemd_preun %{shortname}.service %postun %systemd_postun_with_restart %{shortname}.service %files %config(noreplace) %{_sysconfdir}/default/%{shortname} %doc README.md %license LICENSE %{_bindir}/%{shortname} %{_sysusersdir}/%{shortname}.conf %{_unitdir}/%{shortname}.service %gopkgfiles %changelog %autochangelog