commit 66550fc1ed414adfea6cd33cb650cf6a7f1abc70
Author: leigh123linux <leigh123linux(a)googlemail.com>
Date: Fri Nov 8 12:23:01 2019 +0000
Attempt to fix session scriptlets
plex-media-player.spec | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/plex-media-player.spec b/plex-media-player.spec
index f7244ba..5bbd592 100644
--- a/plex-media-player.spec
+++ b/plex-media-player.spec
@@ -152,20 +152,30 @@ desktop-file-install \
mkdir -p %{buildroot}%{_sharedstatedir}/plex-media-player
%pre session
+# NEVER delete an user or group created by an RPM package. See:
+#
https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Allocation_Strate...
+
# Rename plexmediaplayer to plex-media-player
-%{_bindir}/getent passwd plexmediaplayer >/dev/null && \
- /sbin/usermod -m -l plex-media-player \
- -d %{_sharedstatedir}/plex-media-player -s /sbin/nologin \
- -c "Plex Media Player (Standalone)" plex-media-player
+#
+getent group plexmediaplayer >/dev/null && \
+ groupmod -n plex-media-player plexmediaplayer
+getent passwd plexmediaplayer >/dev/null && \
+ usermod -m -l plex-media-player \
+ -s /sbin/nologin \
+ -d %{_sharedstatedir}/plex-media-player \
+ -c "Plex Media Player (Standalone)" plexmediaplayer
# Create "plex-media-player" if it not already exists.
#
-# NEVER delete an user or group created by an RPM package. See:
-#
https://fedoraproject.org/wiki/Packaging:UsersAndGroups#Allocation_Strate...
-%{_bindir}/getent passwd plex-media-player >/dev/null || \
- /sbin/useradd -r -G dialout,video,lock,audio \
- -d %{_sharedstatedir}/plex-media-player -s /sbin/nologin \
- -c "Plex Media Player (Standalone)" plex-media-player
+getent group plex-media-player >/dev/null || groupadd -r plex-media-player
&>/dev/null || :
+getent passwd plex-media-player >/dev/null || useradd -r -M \
+ -s /sbin/nologin \
+ -d %{_sharedstatedir}/plex-media-player \
+ -c "Plex Media Player (Standalone)" \
+ -G dialout,video,lock,audio \
+ -d %{_sharedstatedir}/plex-media-player \
+ -g plex-media-player plex-media-player &>/dev/null || :
+exit 0
%post session
%systemd_post %{name}.service