# Generated by go2rpm 1.8.2 %bcond_without check %global shortname prometheus-blackbox-exporter # https://github.com/prometheus/blackbox_exporter %global goipath github.com/prometheus/blackbox_exporter # below version is not building for some reason... #Version: 0.23.0 # test failure due to config errors? Version: 0.22.0 #Version: 0.21.1 # REMOVE BEFORE SUBMITTING THIS FOR REVIEW # --- # New Fedora packages should use %%gometa -f, which makes the package # ExclusiveArch to %%golang_arches_future and thus excludes the package from # %%ix86. If the new package is needed as a dependency for another pacage, # please consider removing that package from %%ix86 in the same way, instead of # building more go packages for i686. If your package is not a leaf package, # you'll need to coordinate the removal of the package's dependents first. # --- # REMOVE BEFORE SUBMITTING THIS FOR REVIEW %gometa -f %global common_description %{expand: Blackbox prober exporter.} %global golicenses LICENSE NOTICE %global godocs SECURITY.md MAINTAINERS.md CODE_OF_CONDUCT.md\\\ CONFIGURATION.md README.md CHANGELOG.md Name: %{goname} Release: %autorelease Summary: Blackbox prober exporter License: Apache-2.0 URL: %{gourl} Source0: %{gosource} #Source1: %%{shortname}.sysusers Source2: %{shortname}.service #Source3: %%{shortname}.conf #Source4: %%{shortname}.logrotate BuildRequires: systemd-rpm-macros %description %{common_description} %gopkg %prep %goprep %generate_buildrequires %go_generate_buildrequires %build %gobuild -o %{gobuilddir}/bin/blackbox_exporter %{goipath} %install %gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ mv %{buildroot}%{_bindir}/blackbox_exporter %{buildroot}%{_bindir}/%{shortname} pushd %{buildroot}%{_bindir} #ln -s %{shortname} blackbox_exporter popd # capability needed for ICMP probe # opreation not permitted, uncommented until alternative solution found #setcap cap_net_raw+ep %%{buildroot}%%{_bindir}/%%{shortname} install -Dpm0644 %{S:2} %{buildroot}%{_unitdir}/%{shortname}.service #pushd %{buildroot}%{_unitdir} #ln -s %{shortname}.service blackbox_exporter.service #popd install -Dpm0644 example.yml %{buildroot}%{_datadir}/prometheus/blackbox-exporter/example.yml #install -Dpm0644 %%{S:1} %%{buildroot}%%{_sysusersdir}/%%{shortname}.conf # TODO: adapt logrotate file #install -Dpm0644 %%{S:4} %%{buildroot}%%{_sysconfdir}/logrotate.d/%%{shortname} # N/A? there's already example.yml #install -Dpm0644 %%{S:0}/blackbox.yml %%{buildroot}%%{_datadir}/prometheus/blackbox-exporter/example.yml # taken from https://src.fedoraproject.org/rpms/golang-github-prometheus/blob/rawhide/f/golang-github-prometheus.spec mkdir -vp %{buildroot}/%{_mandir}/man1/ %{buildroot}%{_bindir}/%{shortname} --help-man > \ %{buildroot}/%{_mandir}/man1/%{shortname}.1 sed -i '/^ /d; /^.SH "NAME"/,+1c.SH "NAME"\nprometheus-blackbox-exporter \\- Blackbox prober exporter' \ %{buildroot}/%{_mandir}/man1/%{shortname}.1 ## resolve warn about blackbox_exporter (or just not use that? #cp ${shortname}.1 blackbox_exporter.1 %pre #%sysusers_create_compat %{SOURCE2} %post %systemd_post %{shortname}.service %preun %systemd_preun %{shortname}.service %postun %systemd_postun_with_restart %{shortname}.service %if %{with check} %check %gocheck -d prober -d config %endif %files %license LICENSE NOTICE %doc SECURITY.md MAINTAINERS.md CODE_OF_CONDUCT.md CONFIGURATION.md README.md %doc CHANGELOG.md %{_bindir}/* %{_mandir}/man1/%{shortname}.1* %{_datadir}/prometheus/blackbox-exporter/example.yml %{_unitdir}/%{shortname}.service %gopkgfiles %changelog %autochangelog