summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans-Nikolai Viessmann2018-07-01 20:26:49 +0100
committerHans-Nikolai Viessmann2018-07-01 20:26:49 +0100
commitc7bcea9f82348d15d964be969585fd15a63812b2 (patch)
treef92a8af31574cdf76ed04e1c78fe1211e1334602
parentcd2a0875db551f599d6403836172bafb9f31059b (diff)
downloadaur-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...
-rw-r--r--.SRCINFO5
-rw-r--r--PKGBUILD22
-rw-r--r--plex-media-player-standalone-service.install43
-rw-r--r--plex-media-player.sysusers7
4 files changed, 31 insertions, 46 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 344ec6fc9d2..086cc3be53f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,11 +1,10 @@
pkgbase = plex-media-player-standalone-service
pkgdesc = Systemd service and user to run PMP in stand-alone mode
pkgver = 1.0
- pkgrel = 2
+ pkgrel = 3
url = https://github.com/hv15/plex-media-player-standalone-service
install = plex-media-player-standalone-service.install
arch = x86_64
- arch = i686
license = GPL
depends = systemd
depends = xorg-server
@@ -14,8 +13,10 @@ pkgbase = plex-media-player-standalone-service
depends = polkit
source = https://github.com/hv15/plex-media-player-standalone-service/archive/1.0.tar.gz
source = https://github.com/hv15/plex-media-player-standalone-service/releases/download/1.0/1.0.tar.gz.sig
+ source = plex-media-player.sysusers
sha256sums = a231685b9eed6ccfb0eefcf40b89b823ff8d33954c4daa2d68ed386ac73e172b
sha256sums = SKIP
+ sha256sums = b0fbffc7a8823b0b543dba8cb6d2ad4aa0ef3ec066753de1455f891bee32937d
pkgname = plex-media-player-standalone-service
diff --git a/PKGBUILD b/PKGBUILD
index 4cc3f2c43cb..bbd92e95fee 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,22 +2,28 @@
pkgname=plex-media-player-standalone-service
pkgver=1.0
-pkgrel=2
+pkgrel=3
pkgdesc="Systemd service and user to run PMP in stand-alone mode"
-arch=('x86_64' 'i686')
+arch=('x86_64')
url="https://github.com/hv15/plex-media-player-standalone-service"
license=('GPL')
depends=('systemd' 'xorg-server' 'xorg-xinit' 'plex-media-player' 'polkit')
install="${pkgname}.install"
source=("https://github.com/hv15/${pkgname}/archive/${pkgver}.tar.gz"
- "https://github.com/hv15/${pkgname}/releases/download/${pkgver}/${pkgver}.tar.gz.sig")
+ "https://github.com/hv15/${pkgname}/releases/download/${pkgver}/${pkgver}.tar.gz.sig"
+ "plex-media-player.sysusers")
sha256sums=('a231685b9eed6ccfb0eefcf40b89b823ff8d33954c4daa2d68ed386ac73e172b'
- 'SKIP')
+ 'SKIP'
+ 'b0fbffc7a8823b0b543dba8cb6d2ad4aa0ef3ec066753de1455f891bee32937d')
validgpgkeys=('0x9062A1BF982A2B64')
+prepare() {
+ # we change ther user/group of the service file to pplex.
+ sed -i 's/\(User\|Group\) = plex/\1 = pplex/' "${srcdir}/${pkgname}-${pkgver}/plexmediaplayer.service"
+}
+
package() {
- install -Dm644 "$srcdir/$pkgname-$pkgver/plexmediaplayer.service" \
- "$pkgdir/usr/lib/systemd/system/plexmediaplayer.service"
- install -dm 700 "$pkgdir"/var/lib/plexmediaplayer
- chown 1420:1420 "$pkgdir"/var/lib/plexmediaplayer
+ install -Dm644 "${srcdir}/${pkgname}-${pkgver}/plexmediaplayer.service" \
+ "${pkgdir}/usr/lib/systemd/system/plexmediaplayer.service"
+ install -Dm644 "${srcdir}/plex-media-player.sysusers" "${pkgdir}/usr/lib/sysusers.d/plex-media-player.conf"
}
diff --git a/plex-media-player-standalone-service.install b/plex-media-player-standalone-service.install
index 05edf14acf2..8eae2611f2e 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:
diff --git a/plex-media-player.sysusers b/plex-media-player.sysusers
new file mode 100644
index 00000000000..542d8d6d040
--- /dev/null
+++ b/plex-media-player.sysusers
@@ -0,0 +1,7 @@
+# we create a unique user that does not conflict with the
+# one created by plex-media-server(-plexpass) AUR package(s).
+u pplex - "Plex Media Player" /usr/lib/plexmediaplayer
+m pplex audio
+m pplex video
+m pplex network
+m pplex optical