2
0
mirror of https://github.com/spritsail/plex-media-server.git synced 2024-12-20 11:34:36 +00:00

Fix Plex running as root

This commit is contained in:
Joe Groocock 2017-05-14 17:51:33 +01:00
parent 47ccdf64dc
commit f31ab482d8
2 changed files with 11 additions and 9 deletions

View File

@ -24,4 +24,4 @@ RUN wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.9/libstdc++6_4.9.2-10
WORKDIR /usr/lib/plexmediaserver WORKDIR /usr/lib/plexmediaserver
ENTRYPOINT ["/sbin/tini", "--"] ENTRYPOINT ["/sbin/tini", "--"]
CMD ["su-exec", "$UID:$GID", "start_pms"] CMD exec su-exec $UID:$GID start_pms

View File

@ -1,6 +1,6 @@
--- plexmediaserver/usr/sbin/start_pms --- start_pms
+++ start_pms +++ /usr/bin/start_pms
@@ -1,17 +1,11 @@ @@ -1,17 +1,12 @@
#!/bin/sh #!/bin/sh
-#change these parameters in /etc/default/plexmediaserver -#change these parameters in /etc/default/plexmediaserver
@ -21,16 +21,17 @@
+export PLEX_MEDIA_SERVER_MAX_STACK_SIZE="${PLEX_MEDIA_SERVER_MAX_STACK_SIZE:-3000}" +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_TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR:-/tmp}"
+export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-/config}" +export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-/config}"
+export PLEX_MEDIA_SERVER_CONFIG_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server"
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ] if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
then then
@@ -22,15 +16,17 @@ @@ -22,15 +17,18 @@
exit 1 exit 1
fi fi
fi fi
+if [ ! -w "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ] +if [ ! -w "$PLEX_MEDIA_SERVER_CONFIG_DIR" ]
+then +then
+ echo "ERROR: CANNOT WRITE IN $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR, MAKE SURE I HAVE PERMISSION TO DO THAT!" + echo "ERROR: CANNOT WRITE IN $PLEX_MEDIA_SERVER_CONFIG_DIR, MAKE SURE I HAVE PERMISSION TO DO THAT!"
+ exit 2 + exit 2
+fi +fi
@ -44,8 +45,9 @@
- -
-# Add sleep - Possible fix for start on boot. -# Add sleep - Possible fix for start on boot.
-sleep 3 -sleep 3
+if [ -f /config/Plex\ Media\ Server/plexmediaserver.pid ]; then +PIDFILE="${PLEX_MEDIA_SERVER_CONFIG_DIR}/plexmediaserver.pid"
+ rm -f /config/Plex\ Media\ Server/plexmediaserver.pid +if [ -f "$PIDFILE" ]; then
+ rm -f "$PIDFILE"
+fi +fi
-(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server) -(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)