Add/Remove clustercockpit user and group in RPM

This commit is contained in:
Thomas Roehl 2022-03-02 15:10:14 +01:00
parent 092e7f6a71
commit 0753c81156

View File

@ -39,12 +39,26 @@ install -Dpm 0600 scripts/%{name}.config %{buildroot}%{_sysconfdir}/default/%{na
%check
# go test should be here... :)
%pre
getent group clustercockpit >/dev/null || groupadd -r clustercockpit
getent passwd clustercockpit >/dev/null || \
useradd -r -g clustercockpit -d /nonexistent -s /sbin/nologin \
-c "Create system user and group for CC metric collector" clustercockpit
exit 0
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
if [ "$1" = "1" ]; then
getent passwd clustercockpit >/dev/null && userdel clustercockpit
getent group clustercockpit >/dev/null && groupdel clustercockpit
fi
exit 0
%files
%dir %{_sysconfdir}/%{name}
%{_sbindir}/%{name}