%global debug_package %{nil} %global gitdate 20190923 %global gitcommit 13c5eb2110ddbc7fd22c8e69e5cd4b97840d529b %global shortcommit %(c=%{gitcommit}; echo ${c:0:7}) Name: bind_exporter Version: 0.0 Release: 0.git%{gitdate}%{?dist} Summary: Prometheus exporter for BIND License: ASL 2.0 URL: https://github.com/digitalocean/bind_exporter Source0: https://github.com/digitalocean/bind_exporter/archive/%{gitcommit}/%{name}-%{shortcommit}.tar.gz Source1: %{name}.service Source2: %{name}.default Source3: %{name}.init %{?el7:%{?systemd_requires}} Requires(pre): shadow-utils BuildRequires: golang, git, systemd %description Export BIND(named/dns) v9+ service metrics to Prometheus. %prep %setup -q -n %{name}-%{gitcommit} %build mkdir _build export GOPATH=$(pwd)/_build go get -v -d #go build -v %{name}.go cd $GOPATH/src/github.com/digitalocean/bind_exporter make %install cd _build/src/github.com/digitalocean/bind_exporter mkdir -vp %{buildroot}/%{_sharedstatedir}/prometheus mkdir -vp %{buildroot}/%{_bindir} mkdir -vp %{buildroot}/%{_unitdir} mkdir -vp %{buildroot}/%{_sysconfdir}/default install -m 755 %{name} %{buildroot}/%{_bindir}/%{name} install -m 644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}.service install -m 644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/default/%{name} %pre getent group prometheus >/dev/null || groupadd -r prometheus getent passwd prometheus >/dev/null || \ useradd -r -g prometheus -d /%{_sharedstatedir}/prometheus -s /sbin/nologin \ -c "Prometheus services" prometheus exit 0 %post %systemd_post %{name}.service %preun %systemd_preun %{name}.service %postun %systemd_postun %{name}.service %files %{_bindir}/%{name} %{_unitdir}/%{name}.service %config(noreplace) /etc/default/%{name} %attr(755, prometheus, prometheus)/%{_sharedstatedir}/prometheus %doc CHANGELOG.md LICENSE NOTICE README.md %changelog * Mon Sep 23 2019 Rick Elrod - 0.0-0.git20190923 - Nuke el6 conditionals, assume el7+ - Fix the build - Use rpm macros where we can instead of hardcoded paths * Thu Jan 19 2017 Ilya Otyutskiy - 0.0-0.git20170119.vortex - Initial packaging