# Generated by go2rpm 1.18.0 %bcond check 1 # https://github.com/prometheus/snmp_exporter %global goipath github.com/prometheus/snmp_exporter %global shortname prometheus-snmp-exporter Version: 0.29.0 %gometa -L -f Name: golang-github-prometheus-snmp-exporter Release: %autorelease Summary: SNMP Exporter for Prometheus License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT URL: %{gourl} Source0: %{gosource} Source1: %{archivename}-vendor.tar.bz2 Source2: go-vendor-tools.toml Source3: %{shortname}.conf Source4: %{shortname}.service Source5: %{shortname}.sysusers Patch0: prometheus-snmp-exporter-generator-paths.patch BuildRequires: go-vendor-tools BuildRequires: net-snmp-devel BuildRequires: systemd-rpm-macros Requires(pre): shadow-utils %description SNMP Exporter for Prometheus. %prep %goprep -A %setup -q -T -D -a1 %{forgesetupargs} %autopatch -p1 mv generator/FORMAT.md generator/FORMAT.generator.md mv generator/README.md generator/README.generator.md %generate_buildrequires %go_vendor_license_buildrequires -c %{S:2} %build %global gomodulesmode GO111MODULE=on %gobuild -o %{gobuilddir}/bin/%{shortname} %{goipath} %gobuild -o %{gobuilddir}/bin/prometheus-snmp-generator %{goipath}/generator %install %go_vendor_license_install -c %{S:2} install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ install -Dpm 0644 snmp.yml %{buildroot}%{_sysconfdir}/prometheus/snmp.yml install -Dpm 0644 generator/generator.yml %{buildroot}%{_sysconfdir}/prometheus/snmp-generator.yml install -Dpm 0644 %{S:3} %{buildroot}%{_sysconfdir}/default/%{shortname} install -Dpm 0644 %{S:4} %{buildroot}%{_unitdir}/%{shortname}.service install -Dpm 0644 %{S:5} %{buildroot}%{_sysusersdir}/%{shortname}.conf %check %go_vendor_license_check -c %{S:2} %if %{with check} %gotest ./... %endif %pre %sysusers_create_compat %{S:5} %post %systemd_post %{shortname}.service %preun %systemd_preun %{shortname}.service %postun %systemd_postun_with_restart %{shortname}.service %files -f %{go_vendor_license_filelist} %license vendor/modules.txt %config(noreplace) %{_sysconfdir}/default/%{shortname} %config(noreplace) %{_sysconfdir}/prometheus/snmp.yml %config(noreplace) %{_sysconfdir}/prometheus/snmp-generator.yml %doc CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md MAINTAINERS.md README.md %doc SECURITY.md generator/FORMAT.generator.md generator/README.generator.md %{_bindir}/%{shortname} %{_bindir}/prometheus-snmp-generator %{_sysusersdir}/%{shortname}.conf %{_unitdir}/%{shortname}.service %changelog %autochangelog