Skip to content

Commit 0d83f59

Browse files
authored
Merge pull request #86 from linuxserver/env-fixes
use plex env variables, usermod home folder of abc to /app
2 parents 88c81df + 7b95c71 commit 0d83f59

7 files changed

Lines changed: 34 additions & 24 deletions

File tree

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
FROM lsiobase/xenial
22
MAINTAINER Stian Larsen, sparklyballs
33

4-
# package version
5-
ENV PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu"
64

75
# global environment settings
8-
ENV DEBIAN_FRONTEND="noninteractive"
9-
ENV HOME="/config"
10-
ENV PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server"
6+
ENV DEBIAN_FRONTEND="noninteractive" \
7+
PLEX_DOWNLOAD="https://downloads.plex.tv/plex-media-server" \
8+
PLEX_INSTALL="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" \
9+
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" \
10+
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
11+
PLEX_MEDIA_SERVER_INFO_DEVICE=docker \
12+
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
13+
PLEX_MEDIA_SERVER_USER=abc \
14+
LD_LIBRARY_PATH="/usr/lib/plexmediaserver:$LD_LIBRARY_PATH"
1115

1216
# install packages
1317
RUN \
@@ -23,6 +27,9 @@ RUN \
2327
"${PLEX_INSTALL}" && \
2428
dpkg -i /tmp/plexmediaserver.deb && \
2529

30+
# change abc home folder to fix plex hanging at runtime with usermod
31+
usermod -d /app abc && \
32+
2633
# cleanup
2734
apt-get clean && \
2835
rm -rf \

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ Valid settings for VERSION are:-
100100

101101
## Versions
102102

103+
+ **11.01.17:** Use Plex environemt variables from pms docker,
104+
change abc home folder to /app to alleviate usermod chowning library folder by default (thanks gbooker, plexinc).
103105
+ **03.01.17:** Use case insensitive version variable matching rather than export and make lowercase.
104106
+ **17.10.16:** Allow use of uppercase version variable
105107
+ **01.10.16:** Add TZ info to README.
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
#!/usr/bin/with-contenv bash
22

3-
# check for Library existence and permissions
4-
if [ ! -d "/config/Library" ]; then
5-
mkdir -p /config/Library
6-
chown abc:abc /config/Library
7-
elif [ ! "$(stat -c %u /config/Library)" = "$PUID" ]; then
8-
echo "Change in ownership detected, please be patient while we chown existing files"
9-
echo "This could take some time"
10-
chown abc:abc -R \
3+
# create folders
4+
if [ ! -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" ]; then \
5+
mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}"
6+
chown -R abc:abc /config
7+
fi
8+
9+
# check Library permissions
10+
PUID=${PUID:-911}
11+
if [ ! "$(stat -c %u /config/Library)" = "$PUID" ]; then
12+
echo "Change in ownership detected, please be patient while we chown existing files"
13+
echo "This could take some time"
14+
chown abc:abc -R \
1115
/config/Library
1216
fi
17+
18+
# permissions (non-recursive) on config root and folders
19+
chown abc:abc \
20+
/config \
21+
/config/*

root/etc/cont-init.d/50-plex-update

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/usr/bin/with-contenv bash
22

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

root/etc/services.d/avahi/run

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ done
66

77
echo "Starting Avahi daemon"
88
exec avahi-daemon --no-chroot
9-

root/etc/services.d/dbus/run

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22

33
echo "Starting dbus-daemon"
44
exec dbus-daemon --system --nofork
5-

root/etc/services.d/plex/run

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/with-contenv bash
22

33
echo "Starting Plex Media Server."
4-
exec s6-setuidgid abc /usr/sbin/start_pms
5-
4+
exec \
5+
s6-setuidgid abc /bin/bash -c \
6+
'/usr/lib/plexmediaserver/Plex\ Media\ Server'

0 commit comments

Comments
 (0)