2
0
mirror of https://github.com/spritsail/plex-media-server.git synced 2024-11-05 01:16:23 +00:00
plex-media-server/start_pms.patch

48 lines
1.8 KiB
Diff
Raw Normal View History

2016-08-26 21:26:39 +00:00
--- plexmediaserver/usr/sbin/start_pms
+++ start_pms
@@ -1,13 +1,11 @@
#!/bin/sh
-#change these parameters in /etc/default/plexmediaserver
-export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
-export PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
-export PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
-export PLEX_MEDIA_SERVER_TMPDIR=/tmp
-export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}/Library/Application Support"
-
-test -f /etc/default/plexmediaserver && . /etc/default/plexmediaserver
+# Default values
+export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="${PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS:-6}"
+export PLEX_MEDIA_SERVER_HOME="${PLEX_MEDIA_SERVER_HOME:-<destdir>/plex-media-server}"
+export PLEX_MEDIA_SERVER_MAX_STACK_SIZE="${PLEX_MEDIA_SERVER_MAX_STACK_SIZE:-3000}"
+export PLEX_MEDIA_SERVER_TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR:-/tmp}"
+export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-/config/plex}"
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
then
@@ -19,14 +17,18 @@ then
fi
fi
-export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
+. <destdir>/lib/vars.sh
+export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}:${GLIBC_LIBRARY_PATH}"
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
-echo $PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS $PLEX_MEDIA_SERVER_MAX_STACK_SIZE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR
+# Fix Locale, busybox doesn't care about it
+export LANG=C
+export LC_ALL=C
-ulimit -s $PLEX_MAX_STACK_SIZE
+cd "$PLEX_MEDIA_SERVER_HOME"
-# Add sleep - Possible fix for start on boot.
-sleep 3
+if [ -f /config/plex/Plex\ Media\ Server/plexmediaserver.pid ]; then
+ rm -f /config/plex/Plex\ Media\ Server/plexmediaserver.pid
+fi
-(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)
+exec "$PLEX_MEDIA_SERVER_HOME/Plex Media Server"