From ba627fe96f48a0607074e554e137a120b70b8177 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sun, 24 Mar 2019 23:32:56 +0000
Subject: plex-media-server: update to 1.15.2.793

---
 abs/extra/plex-media-server/PKGBUILD               | 62 ++++++++++++++--------
 .../plex-media-server/plex-media-server.install    |  2 +-
 abs/extra/plex-media-server/plex.sysusers          |  3 +-
 abs/extra/plex-media-server/plex.tmpfiles          |  1 +
 abs/extra/plex-media-server/plexmediascanner.sh    |  2 +-
 abs/extra/plex-media-server/plexmediaserver.conf.d |  4 +-
 .../plex-media-server/plexmediaserver.service      |  4 +-
 7 files changed, 46 insertions(+), 32 deletions(-)
 create mode 100644 abs/extra/plex-media-server/plex.tmpfiles

diff --git a/abs/extra/plex-media-server/PKGBUILD b/abs/extra/plex-media-server/PKGBUILD
index 8122125..1967b43 100644
--- a/abs/extra/plex-media-server/PKGBUILD
+++ b/abs/extra/plex-media-server/PKGBUILD
@@ -1,4 +1,6 @@
-# Maintainer: Tom Moore <t.moore01@gmail.com>
+# Maintainer: Donald Webster <fryfrog@gmail.com>
+# Contributor: Tom Moore <t.moore01@gmail.com>
+# Contributor: Mikael Eriksson <mikael_eriksson@miffe.org>
 # Contributor: Maxime Gauduin <alucryd@archlinux.org>
 # Contributor: Rob Sletten <rsletten@gmail.com>
 # Contributor: monty <linksoft@gmx.de>
@@ -7,42 +9,56 @@
 # Contributor: Praekon <praekon@googlemail.com>
 
 pkgname=plex-media-server
-pkgver=1.14.1.5488
-_pkgsum=cc260c476
+pkgver=1.15.2.793
+_pkgsum=782228f99
 pkgrel=1
 pkgdesc='Plex Media Server'
-arch=('x86_64')
+arch=('x86_64' 'armv7h' 'aarch64')
 url='https://plex.tv/'
 license=('custom')
-depends=('systemd')
-provides=('plex-media-server')
+options=('!emptydirs')
 conflicts=('plex-media-server-plexpass')
-backup=('etc/conf.d/plexmediaserver')
+# Commented to override user version
+#backup=('etc/conf.d/plexmediaserver')
 install='plex-media-server.install'
 source=('plexmediaserver.conf.d'
         'plexmediaserver.service'
         'plex.sysusers'
+        'plex.tmpfiles'
         'plexmediascanner.sh'
-        'terms.txt'
-        "https://downloads.plex.tv/plex-media-server/${pkgver}-${_pkgsum}/plexmediaserver-${pkgver}-${_pkgsum}.x86_64.rpm")
+        'terms.txt')
+
+source_aarch64=("https://downloads.plex.tv/plex-media-server-new/${pkgver}-${_pkgsum}/debian/plexmediaserver_${pkgver}-${_pkgsum}_arm64.deb")
+source_armv7h=("https://downloads.plex.tv/plex-media-server-new/${pkgver}-${_pkgsum}/debian/plexmediaserver_${pkgver}-${_pkgsum}_armhf.deb")
+source_x86_64=("https://downloads.plex.tv/plex-media-server-new/${pkgver}-${_pkgsum}/redhat/plexmediaserver-${pkgver}-${_pkgsum}.x86_64.rpm")
+
+
+prepare() {
+  if [[ $CARCH = armv7h ]] || [[ $CARCH = aarch64 ]]; then
+    bsdtar -xf data.tar.xz
+  fi
+}
 
 package() {
-  install -dm 755 "${pkgdir}"/{opt,etc/conf.d,usr/lib/systemd/system}
-  cp -dr --no-preserve='ownership' usr/lib/plexmediaserver "${pkgdir}"/opt/
-  install -m 644 plexmediaserver.service "${pkgdir}"/usr/lib/systemd/system/
-  install -m 644 plexmediaserver.conf.d "${pkgdir}"/etc/conf.d/plexmediaserver
-  install -Dm 644 "$srcdir/plex.sysusers" "$pkgdir/usr/lib/sysusers.d/plex.conf"
+  install -d -m 755 "${pkgdir}/usr/lib/plexmediaserver"
+  cp -dr --no-preserve='ownership' "${srcdir}/usr/lib/plexmediaserver" "${pkgdir}/usr/lib/"
 
-  install -m 755 -D plexmediascanner.sh "${pkgdir}"/usr/LH/bin/plexmediascanner.sh
+  install -D -m 644 "${srcdir}/plexmediaserver.conf.d" "${pkgdir}/etc/conf.d/plexmediaserver"
+  install -D -m 644 "${srcdir}/plexmediaserver.service" "${pkgdir}/usr/lib/systemd/system/plexmediaserver.service"
+  install -D -m 644 "${srcdir}/plex.sysusers" "${pkgdir}/usr/lib/sysusers.d/plex.conf"
+  install -D -m 644 "${srcdir}/plex.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/plex.conf"
 
-  install -dm 755 "${pkgdir}"/usr/share/licenses/${pkgname}
-  install -m 644 terms.txt "${pkgdir}"/usr/share/licenses/${pkgname}/
+  install -D -m 644 "${srcdir}/terms.txt" "${pkgdir}/usr/share/licenses/${pkgname}/terms.txt"
+  install -m 755 -D plexmediascanner.sh "${pkgdir}"/usr/LH/bin/plexmediascanner.sh
 }
 
 # vim: ts=2 sw=2 et:
-md5sums=('dfd6778f5c0d3d64c2c3a71dca02b7cc'
-         '3f39ee0e8b1ebb1c7ca714f67fa88641'
-         '97241861f2c0b7c82d1945a6c5de8e35'
-         '506ec15815bba749a743780edd2323c8'
-         'af6d0a81c7821b2eddb1bc137310ca1b'
-         'fafb64a6cc876478964e563af35ea1bd')
+md5sums=('16f212dc586df577fa116d80adf1ebf6'
+         '6920747dc9155847688f9d69b8099168'
+         '29849c4600587a92db4b86c3610879e7'
+         'b926b4b845120bd37b640a4982a667dc'
+         'f70da65876e2caac21dc463df234c726'
+         'af6d0a81c7821b2eddb1bc137310ca1b')
+md5sums_x86_64=('df7d79b0eb6253754b480b340f7174a6')
+md5sums_armv7h=('356c25bb2054648157fe1ede56b6f87a')
+md5sums_aarch64=('3bec6bd2d26bc0525bb1c1bf3d63caaa')
diff --git a/abs/extra/plex-media-server/plex-media-server.install b/abs/extra/plex-media-server/plex-media-server.install
index 96a77a7..cc8d2d8 100644
--- a/abs/extra/plex-media-server/plex-media-server.install
+++ b/abs/extra/plex-media-server/plex-media-server.install
@@ -1,5 +1,5 @@
 post_install() {
-  systemd-sysusers plex.conf
+  systemd-sysusers plex.sysusers
   [[ -d /data/storage/disk0/media/plex ]] || install -dm 750 -o plex -g plex /data/storage/disk0/media/plex
   [[ -d /data/storage/disk0/media/plex/tmp ]] || install -dm 750 -o plex -g plex /data/storage/disk0/media/plex/tmp
   [[ -d /data/storage/disk0/media/plex ]] && chown -R plex:plex /data/storage/disk0/media/plex
diff --git a/abs/extra/plex-media-server/plex.sysusers b/abs/extra/plex-media-server/plex.sysusers
index e23680f..ee9fcf1 100644
--- a/abs/extra/plex-media-server/plex.sysusers
+++ b/abs/extra/plex-media-server/plex.sysusers
@@ -1,2 +1 @@
-u plex - "Plex Media Server" /opt/plexmediaserver
-
+u plex - "Plex Media Server" /data/storage/disk0/media/plex
diff --git a/abs/extra/plex-media-server/plex.tmpfiles b/abs/extra/plex-media-server/plex.tmpfiles
new file mode 100644
index 0000000..130fc6f
--- /dev/null
+++ b/abs/extra/plex-media-server/plex.tmpfiles
@@ -0,0 +1 @@
+d /data/storage/disk0/media/plex 0755 plex plex
diff --git a/abs/extra/plex-media-server/plexmediascanner.sh b/abs/extra/plex-media-server/plexmediascanner.sh
index 9ac16c7..6ce2f5d 100755
--- a/abs/extra/plex-media-server/plexmediascanner.sh
+++ b/abs/extra/plex-media-server/plexmediascanner.sh
@@ -3,4 +3,4 @@ exec 2>&1
 export TERM=linux
 . /etc/conf.d/plexmediaserver
 
-sudo -uplex -gplex LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" PLEX_MEDIA_SERVER_HOME="${PLEX_MEDIA_SERVER_HOME}" PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" /opt/plexmediaserver/Plex\ Media\ Scanner $@
+sudo -uplex -gplex LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" PLEX_MEDIA_SERVER_HOME="${PLEX_MEDIA_SERVER_HOME}" PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" /usr/lib/plexmediaserver/Plex\ Media\ Scanner $@
diff --git a/abs/extra/plex-media-server/plexmediaserver.conf.d b/abs/extra/plex-media-server/plexmediaserver.conf.d
index 85ff7a1..253da0b 100644
--- a/abs/extra/plex-media-server/plexmediaserver.conf.d
+++ b/abs/extra/plex-media-server/plexmediaserver.conf.d
@@ -1,5 +1,5 @@
-LD_LIBRARY_PATH=/opt/plexmediaserver
-PLEX_MEDIA_SERVER_HOME=/opt/plexmediaserver
+LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib
+PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
 PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/data/storage/disk0/media/plex
 PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
 PLEX_MEDIA_SERVER_TMPDIR=/data/storage/disk0/media/plex/tmp
diff --git a/abs/extra/plex-media-server/plexmediaserver.service b/abs/extra/plex-media-server/plexmediaserver.service
index 55b3325..1bcd541 100644
--- a/abs/extra/plex-media-server/plexmediaserver.service
+++ b/abs/extra/plex-media-server/plexmediaserver.service
@@ -3,9 +3,8 @@ Description=Plex Media Server
 After=network.target
 
 [Service]
-WorkingDirectory=/opt/plexmediaserver
 EnvironmentFile=/etc/conf.d/plexmediaserver
-ExecStart=/opt/plexmediaserver/Plex\x20Media\x20Server
+ExecStart=/usr/lib/plexmediaserver/Plex\x20Media\x20Server
 Type=simple
 User=plex
 Group=plex
@@ -13,7 +12,6 @@ Restart=on-failure
 RestartSec=5
 StartLimitInterval=60s
 StartLimitBurst=3
-StandardOutput=null
 
 [Install]
 WantedBy=multi-user.target
-- 
cgit v0.12

