From 1efdfcffe3c669abb6bfeaf60ad1b93aa780b5b0 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 15 Jul 2015 23:12:16 +0000
Subject: plex-media-server: add plexmediascanner.sh

---
 abs/extra/plex-media-server/PKGBUILD            | 11 ++++++-----
 abs/extra/plex-media-server/__changelog         |  1 +
 abs/extra/plex-media-server/plexmediascanner.sh |  6 ++++++
 3 files changed, 13 insertions(+), 5 deletions(-)
 create mode 100755 abs/extra/plex-media-server/plexmediascanner.sh

diff --git a/abs/extra/plex-media-server/PKGBUILD b/abs/extra/plex-media-server/PKGBUILD
index f5e11a1..02a7416 100644
--- a/abs/extra/plex-media-server/PKGBUILD
+++ b/abs/extra/plex-media-server/PKGBUILD
@@ -9,7 +9,7 @@
 pkgname=plex-media-server
 pkgver=0.9.12.4.1192
 _pkgsum=9a47d21
-pkgrel=2
+pkgrel=3
 pkgdesc='Plex Media Server'
 arch=('arm' 'armv7h' 'i686' 'x86_64')
 url='https://plex.tv/'
@@ -22,7 +22,8 @@ backup=('etc/conf.d/plexmediaserver')
 install='plex-media-server.install'
 source=('plexmediaserver.conf.d'
         'plexmediaserver.service'
-        'terms.txt')
+        'terms.txt'
+        'plexmediascanner.sh')
 source_arm=("https://downloads.plex.tv/plex-media-server/${pkgver}-${_pkgsum}/PlexMediaServer-${pkgver}-${_pkgsum}-arm.spk")
 source_armv7h=("https://downloads.plex.tv/plex-media-server/${pkgver}-${_pkgsum}/PlexMediaServer-${pkgver}-${_pkgsum}-arm7.spk")
 source_i686=("https://downloads.plex.tv/plex-media-server/${pkgver}-${_pkgsum}/plexmediaserver-${pkgver}-${_pkgsum}.i386.rpm")
@@ -44,8 +45,7 @@ package() {
   install -m 644 plexmediaserver.service "${pkgdir}"/usr/lib/systemd/system/
   install -m 644 plexmediaserver.conf.d "${pkgdir}"/etc/conf.d/plexmediaserver
 
-#  install -dm 755 "${pkgdir}"/data/storage/disk0/media/plex
-#  chown 421:421 -R "${pkgdir}"/data/storage/disk0/media/plex
+  install -m 755 -D plexmediascanner.sh "${pkgdir}"/usr/LH/bin/plexmediascanner.sh
 
   install -dm 755 "${pkgdir}"/usr/share/licenses/plex-media-server
   install -m 644 terms.txt "${pkgdir}"/usr/share/licenses/plex-media-server/
@@ -54,7 +54,8 @@ package() {
 # vim: ts=2 sw=2 et:
 md5sums=('b67fd10314ab756169ec963f710cb9e3'
          '34268b981e3b8c833a0e2270429232a6'
-         'bd703bc750b989a27edd590eb8c8e9d7')
+         'bd703bc750b989a27edd590eb8c8e9d7'
+         '506ec15815bba749a743780edd2323c8')
 md5sums_arm=('53b2d858284dfe75610b9ec08162198e')
 md5sums_armv7h=('630780e6b18a5fb67ab4a26ebac2a4ec')
 md5sums_i686=('b10dc378e66cd8cff5cbfdf6ad0ae540')
diff --git a/abs/extra/plex-media-server/__changelog b/abs/extra/plex-media-server/__changelog
index 2f71af6..54a2097 100644
--- a/abs/extra/plex-media-server/__changelog
+++ b/abs/extra/plex-media-server/__changelog
@@ -2,3 +2,4 @@
 conf.d - change /tmp to data/storage/disk0/media/tmp
 plex-media-server.install - add_service.sh in post_install; remove_service.sh in post_remove
 PKGBUILD - move creation of /data/storage/disk0/media/plex to .install
+PKGBUILD - add plexmediascanner.sh
diff --git a/abs/extra/plex-media-server/plexmediascanner.sh b/abs/extra/plex-media-server/plexmediascanner.sh
new file mode 100755
index 0000000..9ac16c7
--- /dev/null
+++ b/abs/extra/plex-media-server/plexmediascanner.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+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 $@
-- 
cgit v0.12

