Skip to content

Commit f3525ca

Browse files
committed
Add RPM spec file
1 parent 4cc0da5 commit f3525ca

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
%define __spec_install_post %{nil}
2+
%define debug_package %{nil}
3+
%define __os_install_post %{_dbpath}/brp-compress
4+
5+
Name: prometheus-slurm-exporter
6+
Version: 0.3
7+
Release: 1%{?dist}
8+
Summary: Prometheus exporter for SLURM metrics
9+
Group: Monitoring
10+
11+
License: GPL 3.0
12+
URL: https://github.com/vpenso/prometheus-slurm-exporter
13+
14+
Source0: https://github.com/vpenso/prometheus-slurm-exporter/releases/download/%{version}/slurm_exporter-%{version}.linux-amd64.tar.gz
15+
Source1: prometheus-slurm-exporter.service
16+
Source2: LICENSE
17+
Source3: README.md
18+
19+
Requires(pre): shadow-utils
20+
21+
Requires(post): systemd
22+
Requires(preun): systemd
23+
Requires(postun): systemd
24+
%{?systemd_requires}
25+
BuildRequires: systemd
26+
27+
BuildRoot: %{_tmppath}/%{name}-%{version}-1-root
28+
29+
%description
30+
A Prometheus exporter for metrics extracted from the Slurm resource scheduling system.
31+
32+
%prep
33+
%setup -q
34+
35+
%build
36+
# Empty section.
37+
38+
%install
39+
rm -rf %{buildroot}
40+
mkdir -vp %{buildroot}
41+
mkdir -vp %{buildroot}%{_unitdir}/
42+
mkdir -vp %{buildroot}/usr/bin
43+
mkdir -vp %{buildroot}/usr/share/doc/prometheus-slurm-exporter-%{version}
44+
mkdir -vp %{buildroot}/var/lib/prometheus
45+
install -m 755 prometheus-slurm-exporter %{buildroot}/usr/bin/prometheus-slurm-exporter
46+
install -m 644 %{SOURCE1} %{buildroot}/usr/lib/systemd/system/prometheus-slurm-exporter.service
47+
install -m 644 %{SOURCE2} %{buildroot}/usr/share/doc/prometheus-slurm-exporter-%{version}/LICENSE
48+
install -m 644 %{SOURCE3} %{buildroot}/usr/share/doc/prometheus-slurm-exporter-%{version}/README.md
49+
50+
%clean
51+
rm -rf %{buildroot}
52+
53+
%pre
54+
getent group prometheus >/dev/null || groupadd -r prometheus
55+
getent passwd prometheus >/dev/null || \
56+
useradd -r -g prometheus -d /var/lib/slurm_exporter -s /sbin/nologin \
57+
-c "Prometheus exporter user" prometheus
58+
exit 0
59+
60+
%post
61+
systemctl enable %{name}.service
62+
systemctl start %{name}.service
63+
64+
%preun
65+
%systemd_preun %{name}.service
66+
67+
%postun
68+
%systemd_postun_with_restart %{name}.service
69+
70+
%files
71+
%defattr(-,root,root,-)
72+
%doc LICENSE
73+
%doc README.md
74+
%{_bindir}/prometheus-slurm-exporter
75+
%{_unitdir}/%{name}.service
76+
%attr(755, prometheus, prometheus)/var/lib/prometheus
77+
78+
%changelog
79+
* Fri Feb 16 2018 Matteo <[email protected]> - 0.3
80+
- Fix issue #4
81+
* Wed Jan 31 2018 Matteo <[email protected]> - 0.2
82+
- Fix issue #3
83+
* Mon Dec 04 2017 Matteo <[email protected]> - 0.1
84+
- Full commit history: https://github.com/vpenso/prometheus-slurm-exporter/commits/master

0 commit comments

Comments
 (0)