From bac8b14e6cd7dc11383970a7e058a49f6890b0a6 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Wed, 11 Jan 2017 19:16:55 +0000 Subject: [PATCH] use plex env variables, usermod home folder of abc to /app --- Dockerfile | 11 ++++++++--- README.md | 2 ++ root/etc/cont-init.d/40-chown-files | 20 ++++++++++++-------- root/etc/services.d/plex/run | 3 ++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 73a4632..c5b7d96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,11 @@ MAINTAINER Stian Larsen, sparklyballs ENV PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" # global environment settings -ENV DEBIAN_FRONTEND="noninteractive" -ENV HOME="/config" -ENV PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" +ENV DEBIAN_FRONTEND="noninteractive" \ +PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" \ +PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \ +PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \ +PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" # install packages RUN \ @@ -23,6 +25,9 @@ RUN \ "${PLEX_INSTALL}" && \ dpkg -i /tmp/plexmediaserver.deb && \ +# change abc home folder to fix plex hanging at runtime with usermod + usermod -d /app abc && \ + # cleanup apt-get clean && \ rm -rf \ diff --git a/README.md b/README.md index 54a2311..4508e85 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,8 @@ Valid settings for VERSION are:- ## Versions ++ **11.01.17:** Use Plex environemt variables from pms docker, +change abc home folder to /app to alleviate usermod chowning library folder by default (thanks gbooker, plexinc). + **03.01.17:** Use case insensitive version variable matching rather than export and make lowercase. + **17.10.16:** Allow use of uppercase version variable + **01.10.16:** Add TZ info to README. diff --git a/root/etc/cont-init.d/40-chown-files b/root/etc/cont-init.d/40-chown-files index fa3c826..062a022 100644 --- a/root/etc/cont-init.d/40-chown-files +++ b/root/etc/cont-init.d/40-chown-files @@ -1,12 +1,16 @@ #!/usr/bin/with-contenv bash # check for Library existence and permissions -if [ ! -d "/config/Library" ]; then - mkdir -p /config/Library - chown abc:abc /config/Library -elif [ ! "$(stat -c %u /config/Library)" = "$PUID" ]; then - echo "Change in ownership detected, please be patient while we chown existing files" - echo "This could take some time" - chown abc:abc -R \ - /config/Library +if [ ! -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ]; then + mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" + chown abc:abc "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" +elif [ ! "$(stat -c %u ${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR})" = "$PUID" ]; then + echo "Change in ownership detected, please be patient while we chown existing files" + echo "This could take some time" + chown abc:abc -R \ + "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" fi + +chown abc:abc \ + /config \ + /config/* diff --git a/root/etc/services.d/plex/run b/root/etc/services.d/plex/run index 0a979f9..b3556ec 100644 --- a/root/etc/services.d/plex/run +++ b/root/etc/services.d/plex/run @@ -1,5 +1,6 @@ #!/usr/bin/with-contenv bash echo "Starting Plex Media Server." -exec s6-setuidgid abc /usr/sbin/start_pms +exec s6-setuidgid abc /bin/sh -c 'LD_LIBRARY_PATH=/usr/lib/plexmediaserver /usr/lib/plexmediaserver/Plex\ Media\ Server' +