summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD23
-rw-r--r--plex-media-player-standalone-service.install44
3 files changed, 88 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..344ec6fc9d2c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = plex-media-player-standalone-service
+ pkgdesc = Systemd service and user to run PMP in stand-alone mode
+ pkgver = 1.0
+ pkgrel = 2
+ 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
+ depends = xorg-xinit
+ depends = plex-media-player
+ 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
+ sha256sums = a231685b9eed6ccfb0eefcf40b89b823ff8d33954c4daa2d68ed386ac73e172b
+ sha256sums = SKIP
+
+pkgname = plex-media-player-standalone-service
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..4cc3f2c43cbd
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,23 @@
+# Maintainer: Hans-Nikolai Viessmann <hv15 AT hw.ac.uk>
+
+pkgname=plex-media-player-standalone-service
+pkgver=1.0
+pkgrel=2
+pkgdesc="Systemd service and user to run PMP in stand-alone mode"
+arch=('x86_64' 'i686')
+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")
+sha256sums=('a231685b9eed6ccfb0eefcf40b89b823ff8d33954c4daa2d68ed386ac73e172b'
+ 'SKIP')
+validgpgkeys=('0x9062A1BF982A2B64')
+
+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
+}
diff --git a/plex-media-player-standalone-service.install b/plex-media-player-standalone-service.install
new file mode 100644
index 000000000000..05edf14acf2e
--- /dev/null
+++ b/plex-media-player-standalone-service.install
@@ -0,0 +1,44 @@
+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_install() {
+ if [ -f /usr/lib/systemd/system/plexmediaplayer.service ]; then
+ /usr/bin/systemctl status plexmediaplayer.service &>/dev/null
+ if [[ $? -eq 0 ]]; then
+ # PMP is running via this service
+ /usr/bin/systemctl stop plexmediaplayer.service &>/dev/null
+ else
+ /bin/true
+ fi
+ else
+ /bin/true
+ fi
+}