diff options
author | Hans-Nikolai Viessmann | 2018-07-01 20:26:49 +0100 |
---|---|---|
committer | Hans-Nikolai Viessmann | 2018-07-01 20:26:49 +0100 |
commit | c7bcea9f82348d15d964be969585fd15a63812b2 (patch) | |
tree | f92a8af31574cdf76ed04e1c78fe1211e1334602 /plex-media-player-standalone-service.install | |
parent | cd2a0875db551f599d6403836172bafb9f31059b (diff) | |
download | aur-c7bcea9f82348d15d964be969585fd15a63812b2.tar.gz |
changed user name to pplex
based upon user feedback, we have a complict with
plex-media-server(-plexpass) because they both use the same user but
have different home directories.
This commit also moves to using sysusers.d instead of some BASHisms...
Diffstat (limited to 'plex-media-player-standalone-service.install')
-rw-r--r-- | plex-media-player-standalone-service.install | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/plex-media-player-standalone-service.install b/plex-media-player-standalone-service.install index 05edf14acf2e..8eae2611f2e2 100644 --- a/plex-media-player-standalone-service.install +++ b/plex-media-player-standalone-service.install @@ -1,44 +1,15 @@ -post_install() { - getent group plex > /dev/null || groupadd -g 1420 plex - if ! getent passwd plex > /dev/null; then - useradd -c 'plex media player user' -u 1420 -g plex -G audio,video,network,optical \ - -d /var/lib/plexmediaplayer -s /usr/bin/nologin plex - passwd -l plex > /dev/null - fi -} - -post_upgrade() { - post_install $1 - if ! getent group plex | cut -d: -f3 | grep 1420 > /dev/null 2>&1; then - groupmod -g 1420 plex > /dev/null 2>&1 - fi - if ! id -u plex | grep 1420 > /dev/null 2>&1; then - usermod -u 1420 plex > /dev/null 2>&1 - if [[ $? -ne 0 ]]; then - echo "Changing uid of user \`plex' failed." - echo "It is recommended that the uid is changed." - echo "Stop all processes running under the plex user and reinstall" - echo "this package or change the uid manually. (usermod -u 1420 plex)" - fi - chown -R plex:plex /var/lib/plexmediaplayer - fi -} - -post_remove() { - getent passwd plex > /dev/null 2>&1 && userdel plex - getent group plex > /dev/null 2>&1 && groupdel plex +pre_upgrade() { + pre_install } pre_install() { if [ -f /usr/lib/systemd/system/plexmediaplayer.service ]; then - /usr/bin/systemctl status plexmediaplayer.service &>/dev/null - if [[ $? -eq 0 ]]; then + if /usr/bin/systemctl is-active --quiet plexmediaplayer.service; then # PMP is running via this service - /usr/bin/systemctl stop plexmediaplayer.service &>/dev/null - else - /bin/true + echo "==> stopping running PMP service..." + /usr/bin/systemctl --quiet stop plexmediaplayer.service fi - else - /bin/true fi } + +# vim: ts=2 sw=2 et: |