Merge pull request #86 from linuxserver/env-fixes

use plex env variables, usermod home folder of abc to /app
This commit is contained in:
aptalca 2017-01-12 22:56:38 -05:00 committed by GitHub
commit 0d83f598ff
7 changed files with 34 additions and 24 deletions

View file

@ -1,13 +1,17 @@
FROM lsiobase/xenial FROM lsiobase/xenial
MAINTAINER Stian Larsen, sparklyballs MAINTAINER Stian Larsen, sparklyballs
# package version
ENV PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu"
# global environment settings # global environment settings
ENV DEBIAN_FRONTEND="noninteractive" ENV DEBIAN_FRONTEND="noninteractive" \
ENV HOME="/config" PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" \
ENV PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" \
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
PLEX_MEDIA_SERVER_INFO_DEVICE=docker \
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
PLEX_MEDIA_SERVER_USER=abc \
LD_LIBRARY_PATH="/usr/lib/plexmediaserver:$LD_LIBRARY_PATH"
# install packages # install packages
RUN \ RUN \
@ -23,6 +27,9 @@ RUN \
"${PLEX_INSTALL}" && \ "${PLEX_INSTALL}" && \
dpkg -i /tmp/plexmediaserver.deb && \ dpkg -i /tmp/plexmediaserver.deb && \
# change abc home folder to fix plex hanging at runtime with usermod
usermod -d /app abc && \
# cleanup # cleanup
apt-get clean && \ apt-get clean && \
rm -rf \ rm -rf \

View file

@ -100,6 +100,8 @@ Valid settings for VERSION are:-
## Versions ## 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. + **03.01.17:** Use case insensitive version variable matching rather than export and make lowercase.
+ **17.10.16:** Allow use of uppercase version variable + **17.10.16:** Allow use of uppercase version variable
+ **01.10.16:** Add TZ info to README. + **01.10.16:** Add TZ info to README.

View file

@ -1,12 +1,21 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# check for Library existence and permissions # create folders
if [ ! -d "/config/Library" ]; then if [ ! -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ]; then \
mkdir -p /config/Library mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}"
chown abc:abc /config/Library chown -R abc:abc /config
elif [ ! "$(stat -c %u /config/Library)" = "$PUID" ]; then fi
# check Library permissions
PUID=${PUID:-911}
if [ ! "$(stat -c %u /config/Library)" = "$PUID" ]; then
echo "Change in ownership detected, please be patient while we chown existing files" echo "Change in ownership detected, please be patient while we chown existing files"
echo "This could take some time" echo "This could take some time"
chown abc:abc -R \ chown abc:abc -R \
/config/Library /config/Library
fi fi
# permissions (non-recursive) on config root and folders
chown abc:abc \
/config \
/config/*

View file

@ -1,9 +1,5 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# copy config on first run, regardless of update status
[[ ! -e /etc/default/plexmediaserver ]] && \
cp /defaults/plexmediaserver /etc/default/plexmediaserver
# test if plex is installed and try re-pulling latest if not # test if plex is installed and try re-pulling latest if not
if (dpkg --get-selections plexmediaserver | grep -wq "install"); then if (dpkg --get-selections plexmediaserver | grep -wq "install"); then
: :
@ -117,6 +113,3 @@ else
dpkg -i --force-confold /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb dpkg -i --force-confold /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb
rm -f /tmp/plexmediaserver_*.deb rm -f /tmp/plexmediaserver_*.deb
fi fi
# recopy config file
cp /defaults/plexmediaserver /etc/default/plexmediaserver

View file

@ -6,4 +6,3 @@ done
echo "Starting Avahi daemon" echo "Starting Avahi daemon"
exec avahi-daemon --no-chroot exec avahi-daemon --no-chroot

View file

@ -2,4 +2,3 @@
echo "Starting dbus-daemon" echo "Starting dbus-daemon"
exec dbus-daemon --system --nofork exec dbus-daemon --system --nofork

View file

@ -1,5 +1,6 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
echo "Starting Plex Media Server." echo "Starting Plex Media Server."
exec s6-setuidgid abc /usr/sbin/start_pms exec \
s6-setuidgid abc /bin/bash -c \
'/usr/lib/plexmediaserver/Plex\ Media\ Server'