%global debug_package %{nil} Name: node_exporter Version: 1.0.0 Release: rc.0.1%{?dist} Summary: System-level exporter for prometheus License: ASL 2.0 URL: https://github.com/prometheus/node_exporter #Source0: https://github.com/prometheus/node_exporter/archive/%{version}.tar.gz Source0: %{name}.tar.gz Source1: %{name}.service Source2: %{name}.sysconfig Source3: https://storage.googleapis.com/golang/go1.14.2.linux-amd64.tar.gz BuildRequires: systemd BuildRequires: gcc %{?systemd_requires} %post %systemd_post node_exporter.service %preun %systemd_preun node_exporter.service %postun %systemd_postun_with_restart node_exporter.service %description System-level exporter for prometheus. %prep %setup -q -c %setup -q -T -D -a 3 %build mkdir -p goapp/src/github.com/prometheus # mv %{name}-%{version} goapp/src/github.com/prometheus/node_exporter mv %{name} goapp/src/github.com/prometheus/node_exporter export GOROOT=${PWD}/go export GOPATH=${PWD}/goapp export PATH=${PWD}/go/bin:${PATH} go install github.com/prometheus/node_exporter %install rm -rf $RPM_BUILD_ROOT %{__install} -d $RPM_BUILD_ROOT%{_bindir} %{__install} -v -D -t $RPM_BUILD_ROOT%{_bindir} goapp/bin/node_exporter %{__install} -d $RPM_BUILD_ROOT%{_unitdir} %{__install} -v -D -t $RPM_BUILD_ROOT%{_unitdir} %{SOURCE1} %{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig %{__install} -m 644 -T %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/%{name} %files %doc goapp/src/github.com/prometheus/node_exporter/*.md %{_bindir}/%{name} %{_unitdir}/%{name}.service %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %changelog * Mon Aug 22 2016 Paul Komkoff -