File golang-github-justwatchcom-elasticsearch_exporter.spec of Package golang-github-justwatchcom-elasticsearch_exporter
#
# spec file for package golang-github-justwatchcom-elasticsearch_exporter
#
# Copyright (c) 2020 SUSE LCC, Inc
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{go_nostrip}
Name: golang-github-justwatchcom-elasticsearch_exporter
Version: 1.1.0
Release: 0
Summary: Elasticsearch stats exporter for Prometheus
License: Apache-2.0
Group: System/Management
Url: https://prometheus.io/
Source: elasticsearch_exporter-%{version}.tar.gz
Source1: prometheus-elasticsearch_exporter.service
Source4: prometheus-elasticsearch_exporter.sysconfig
BuildRequires: fdupes
BuildRequires: go1.11
BuildRequires: golang-packaging
BuildRequires: golang(github.com/prometheus/promu)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
Requires(post): %fillup_prereq
Requires(pre): shadow
%{go_provides}
Provides: elasticsearch_exporter
Provides: prometheus(elasticsearch_exporter)
#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
%define project github.com/justwatchcom/elasticsearch_exporter
%description
Prometheus exporter for various metrics about ElasticSearch, written in Go.
%prep
%setup -q -n elasticsearch_exporter-%{version}
%build
%goprep %{project}
%gobuild
%install
%goinstall
%gosrc
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/prometheus-elasticsearch_exporter.service
install -Dd -m 0755 %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcprometheus-elasticsearch_exporter
install -D -m 0644 %{SOURCE4} %{buildroot}%{_fillupdir}/sysconfig.prometheus-elasticsearch_exporter
%gofilelist
%fdupes %{buildroot}
%pre
%service_add_pre prometheus-elasticsearch_exporter.service
getent group prometheus >/dev/null || %{_sbindir}/groupadd -r prometheus
getent passwd prometheus >/dev/null || %{_sbindir}/useradd -r -g prometheus -d %{_localstatedir}/lib/prometheus -M -s /sbin/nologin -c "Prometheus User" prometheus
%post
%service_add_post prometheus-elasticsearch_exporter.service
%fillup_only -n prometheus-elasticsearch_exporter
%preun
%service_del_preun prometheus-elasticsearch_exporter.service
%postun
%service_del_postun prometheus-elasticsearch_exporter.service
%files -f file.lst
%defattr(-,root,root,-)
%doc *.md VERSION
%license LICENSE
%{_bindir}/elasticsearch_exporter
%{_unitdir}/prometheus-elasticsearch_exporter.service
%{_sbindir}/rcprometheus-elasticsearch_exporter
%{_fillupdir}/sysconfig.prometheus-elasticsearch_exporter
%changelog