# Disable debug rpm on EPEL/CentOS Stream %global debug_package %{nil} # https://github.com/bakins/php-fpm-exporter %global goipath github.com/bakins/php-fpm-exporter Version: 0.6.1 %global user php-fpm-exporter %gometa %global common_description %{expand: Export php-fpm metrics in Prometheus format.} %global golicenses LICENSE Name: php-fpm-exporter Release: 1%{?dist} Summary: Prometheus exporter for php-fpm status URL: %{gourl} License: MIT Source0: %{gosource} Source1: %{name}.service Source2: %{name}.conf Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %description %{common_description} #%%gopkg %prep %autosetup %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}/%{name} install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/systemd/system/%{name}.service install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %pre getent passwd %{user} >/dev/null || \ useradd -r -s /sbin/nologin -d / -M \ -c "Exporter for php-fpm metrics" -g nobody %{user} exit 0 %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun_with_restart %{name}.service %files %license LICENSE %doc README.md %{_bindir}/%{name} %{_prefix}/lib/systemd/system/%{name}.service %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}