[packages/domoticz] handle user/group correctly

atler atler at pld-linux.org
Fri Apr 9 00:36:55 CEST 2021


commit ed4fe78798f66951157fee9b7acb99180066e650
Author: Jan Palus <atler at pld-linux.org>
Date:   Thu Apr 8 21:54:01 2021 +0200

    handle user/group correctly

 domoticz.spec | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/domoticz.spec b/domoticz.spec
index e7a597f..7f0a9c4 100644
--- a/domoticz.spec
+++ b/domoticz.spec
@@ -42,6 +42,8 @@ Requires(pre):	/usr/sbin/useradd
 Requires(post,preun,postun):	systemd-units >= 38
 Requires:	fonts-TTF-Google-Droid
 Requires:	libopenzwave >= 1.5.0
+Provides:	group(domoticz)
+Provides:	user(domoticz)
 
 %description
 Domoticz is a Home Automation System that lets you monitor and
@@ -117,12 +119,8 @@ ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \
 rm -rf $RPM_BUILD_ROOT
 
 %pre
-getent group domoticz >/dev/null || groupadd -r domoticz
-getent passwd domoticz >/dev/null || \
-useradd -r -g domoticz -d %{_datadir}/%{name} -s /sbin/nologin \
--c "Domoticz Home Automation Server" domoticz
-# For OpenZWave USB access (/dev/ttyACM#)
-usermod -G domoticz,dialout domoticz
+%groupadd -g 342 domoticz
+%useradd -u 342 -r -d %{_datadir} -s /bin/false -c "Domoticz Home Automation Server" -G dialout -g domoticz domoticz
 
 %post
 %systemd_post %{name}.service
@@ -131,6 +129,10 @@ usermod -G domoticz,dialout domoticz
 %systemd_preun %{name}.service
 
 %postun
+if [ "$1" = "0" ]; then
+	%userremove mpd
+	%groupremove mpd
+fi
 %systemd_reload
 
 %files
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/domoticz.git/commitdiff/e9c32406e214bcb0cc4d1bdb36febd7690105e64



More information about the pld-cvs-commit mailing list