Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RockyLinux 9 #110

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Update specfile to create slurm_exporter user
  • Loading branch information
m-bull committed Apr 29, 2022
commit 8b4fa8407cdde57d7d4ed70d9e116551662051ad
13 changes: 7 additions & 6 deletions packages/rpm-ci/prometheus-slurm-exporter.spec
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ mkdir -vp %{buildroot}
mkdir -vp %{buildroot}%{_unitdir}/
mkdir -vp %{buildroot}/usr/bin
mkdir -vp %{buildroot}/usr/share/doc/%{name}-%{version}
mkdir -vp %{buildroot}/var/lib/prometheus
mkdir -vp %{buildroot}/var/lib/slurm_exporter
install -m 644 %{SOURCE1} %{buildroot}/usr/lib/systemd/system/%{name}.service
install -m 644 %{SOURCE2} %{buildroot}/usr/share/doc/%{name}-%{version}/LICENSE
install -m 644 %{SOURCE3} %{buildroot}/usr/share/doc/%{name}-%{version}/README.md
@@ -52,17 +52,18 @@ install -m 755 %{SOURCE4} %{buildroot}/usr/bin/%{name}
rm -rf %{buildroot}

%pre
getent group prometheus >/dev/null || groupadd -r prometheus
getent passwd prometheus >/dev/null || \
useradd -r -g prometheus -d /var/lib/slurm_exporter -s /sbin/nologin \
-c "Prometheus exporter user" prometheus
getent group slurm_exporter >/dev/null || groupadd -r slurm_exporter
getent passwd slurm_exporter >/dev/null || \
useradd -r -g slurm_exporter -d /var/lib/slurm_exporter -s /sbin/nologin \
-c "Prometheus Slurm exporter user" slurm_exporter
exit 0

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service
userdel slurm_exporter

%postun
%systemd_postun_with_restart %{name}.service
@@ -74,5 +75,5 @@ exit 0
%{_bindir}/%{name}
/usr/share/doc/%{name}-%{version}/
%{_unitdir}/%{name}.service
%attr(755, prometheus, prometheus)/var/lib/prometheus
%attr(755, slurm_exporter, slurm_exporter)/var/lib/slurm_exporter