[packages/opendmarc] - standardized user/group handling
qboosh
qboosh at pld-linux.org
Sun Apr 6 19:01:16 CEST 2025
commit 863345b1c0a29828adeca3433a05f4f219f40b9a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Apr 6 18:39:40 2025 +0200
- standardized user/group handling
opendmarc.spec | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/opendmarc.spec b/opendmarc.spec
index b376c77..3f83305 100644
--- a/opendmarc.spec
+++ b/opendmarc.spec
@@ -1,5 +1,4 @@
# TODO
-# - pld useradd/groupadd and register uid/gid
# - pldize initscript
%define ver 1-4-2
%define ver_dot %(echo %{ver} | tr '-' '.')
@@ -35,7 +34,15 @@ BuildRequires: libspf2-devel
BuildRequires: pkgconfig
BuildRequires: rpmbuild(macros) >= 1.644
BuildRequires: sendmail-devel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires(postun): /usr/sbin/groupdel
+Requires(postun): /usr/sbin/userdel
Requires: libopendmarc = %{version}-%{release}
+Provides: group(opendmarc)
+Provides: user(opendmarc)
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -142,10 +149,8 @@ cp -p libopendmarc/dmarc.h $RPM_BUILD_ROOT%{_includedir}/%{name}
rm -rf $RPM_BUILD_ROOT
%pre
-getent group %{name} >/dev/null || groupadd -r %{name}
-getent passwd %{name} >/dev/null || \
- useradd -r -g %{name} -G mail -d %{_localstatedir}/run/%{name} -s /sbin/nologin \
- -c "OpenDMARC Milter" %{name}
+%groupadd -g 353 opendmarc
+%useradd -u 353 -G mail -g opendmarc -d %{_localstatedir}/run/%{name} -s /sbin/nologin -c "OpenDMARC Milter" opendmarc
%post
/sbin/chkconfig --add %{name}
@@ -157,6 +162,12 @@ if [ $1 -eq 0 ]; then
%service %{name} stop
fi
+%postun
+if [ "$1" = "0" ]; then
+ %userremove opendmarc
+ %groupremove opendmarc
+fi
+
%post -n libopendmarc -p /sbin/ldconfig
%postun -n libopendmarc -p /sbin/ldconfig
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/opendmarc.git/commitdiff/863345b1c0a29828adeca3433a05f4f219f40b9a
More information about the pld-cvs-commit
mailing list