From ae5da8f32598c12c70b29a0e4c682c48bc8ca9ac Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 09:52:41 +0200 Subject: [PATCH 01/15] Depricateing the Envoriment setting PLEXPASS --- init/30_update_plex.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index fa8594d..4a6a8e3 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -13,11 +13,10 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) [ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then - VERSION=$(curl -s https://tools.linuxserver.io/latest-plexpass.json | grep "version" | cut -d '"' -f 4) - echo "Using version: $VERSION from Plexpass latest" + echo "Usage of VERSION=PLEXPASS is depricated. latest\plexpass is automatic based upon your plex account." elif [[ $VERSION = "latest" || -z $VERSION ]]; then VERSION=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "version" | cut -d '"' -f 4) - echo "Using version: $VERSION from Public latest" + echo "Using version: $VERSION from latest" else echo "Using version: $VERSION from Manual" fi From 4e5532d7822b726eb5151a3dc0a7cbad345cd093 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 10:20:52 +0200 Subject: [PATCH 02/15] Initial work on alter the update rutine Removes lots of old code, replaceing with new token based authentication. --- init/30_update_plex.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index 4a6a8e3..4974100 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -10,17 +10,29 @@ while ! ping -c1 tools.linuxserver.io &>/dev/null; do :; done #The following error is not an error. INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) -[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" -if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then - echo "Usage of VERSION=PLEXPASS is depricated. latest\plexpass is automatic based upon your plex account." -elif [[ $VERSION = "latest" || -z $VERSION ]]; then - VERSION=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "version" | cut -d '"' -f 4) - echo "Using version: $VERSION from latest" +#Get stuff from things. +PLEX_TOKEN=$() +[ -z PLEX_TOKEN ] && echo "Plex token not avalible, please login " && exit 0 +PLEX_LATEST=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) + +[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" +if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi + + +#Start update rutine + + +if [ "$VERSION" = latest || "$VERSION" = plexpass ]; then + VERSION=$PLEX_LATEST + echo "Target version: $VERSION set by: latest\plexpass" else - echo "Using version: $VERSION from Manual" + echo "Target version: $VERSION set by: manually" fi + + + last=130 if [[ "$VERSION" == "" ]]; then echo "ERROR: No version found, running installed version $INSTALLED" From 35658d69b0b6195fd7a6b7413fc61b921abb82e2 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 10:31:32 +0200 Subject: [PATCH 03/15] Removed need for gdebi --- Dockerfile | 2 +- init/30_update_plex.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b0225f..9328b15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER Stian Larsen # Install Plex RUN apt-get -q update && \ PLEXURL=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "ubuntu64" | cut -d '"' -f 4) && \ -apt-get install -qy dbus gdebi-core avahi-daemon wget && \ +apt-get install -qy dbus avahi-daemon wget && \ wget -P /tmp "$PLEXURL" && \ gdebi -n /tmp/plexmediaserver_*_amd64.deb && \ rm -f /tmp/plexmediaserver_*_amd64.deb && \ diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index 4974100..1e3dccc 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -44,7 +44,7 @@ elif [[ "$VERSION" != "$INSTALLED" ]]; then last=$? done apt-get remove --purge -y plexmediaserver - gdebi -n /tmp/plexmediaserver_"${VERSION}"_amd64.deb + dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb else echo "No need to update!" fi From dc54d7adb281441cf14d929963b0f23d47898f76 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 10:33:32 +0200 Subject: [PATCH 04/15] Expose more ports Should also close #30 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9328b15..9eca601 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,4 +22,4 @@ ADD plexmediaserver /defaults/plexmediaserver #Mappings and ports VOLUME ["/config", "/transcode"] -EXPOSE 32400 +EXPOSE 32400 32400/udp 32469 32469/udp 5353/udp 1900/udp From 4fdc48ea3dc0e85831d0ab2e6009f1a86b936bdd Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 10:45:55 +0200 Subject: [PATCH 05/15] Added sed command for token --- init/30_update_plex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index 1e3dccc..afa09ce 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -12,7 +12,7 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) #Get stuff from things. -PLEX_TOKEN=$() +PLEX_TOKEN=$(cat /config/Library/Application Support/Plex Media Server/Preferences.xml | sed -n 's/.*PlexOnlineToken="//p' | sed "s/\".*//") [ -z PLEX_TOKEN ] && echo "Plex token not avalible, please login " && exit 0 PLEX_LATEST=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) From a7785bcac0d1bd1344aeada42f720e832cbb06bb Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 10:53:42 +0200 Subject: [PATCH 06/15] gdebi gdebi is gone, now also from Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9eca601..d164bbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apt-get -q update && \ PLEXURL=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "ubuntu64" | cut -d '"' -f 4) && \ apt-get install -qy dbus avahi-daemon wget && \ wget -P /tmp "$PLEXURL" && \ -gdebi -n /tmp/plexmediaserver_*_amd64.deb && \ +dpkg -i /tmp/plexmediaserver_*_amd64.deb && \ rm -f /tmp/plexmediaserver_*_amd64.deb && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* From a6823e337e7251e3bd182e42a785c3d50b23d795 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 10:58:28 +0200 Subject: [PATCH 07/15] Quoting the path to plex prefs. --- init/30_update_plex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index afa09ce..e51a6b3 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -12,7 +12,7 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) #Get stuff from things. -PLEX_TOKEN=$(cat /config/Library/Application Support/Plex Media Server/Preferences.xml | sed -n 's/.*PlexOnlineToken="//p' | sed "s/\".*//") +PLEX_TOKEN=$(cat "/config/Library/Application Support/Plex Media Server/Preferences.xml" | sed -n 's/.*PlexOnlineToken="//p' | sed "s/\".*//") [ -z PLEX_TOKEN ] && echo "Plex token not avalible, please login " && exit 0 PLEX_LATEST=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) From 0f08c6d56ef04949c049b01c6f0a8805585efd75 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Wed, 30 Mar 2016 11:01:10 +0200 Subject: [PATCH 08/15] Fix for version detector --- init/30_update_plex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index e51a6b3..737b8aa 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -23,7 +23,7 @@ if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo " #Start update rutine -if [ "$VERSION" = latest || "$VERSION" = plexpass ]; then +if [[] "$VERSION" = latest || "$VERSION" = plexpass ]]; then VERSION=$PLEX_LATEST echo "Target version: $VERSION set by: latest\plexpass" else From 25521a4f79cb4b2d7731a8d64a2b531f53f163ab Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Thu, 7 Apr 2016 08:40:31 +0200 Subject: [PATCH 09/15] Removed extra "]" --- init/30_update_plex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index 737b8aa..33d70e0 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -23,7 +23,7 @@ if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo " #Start update rutine -if [[] "$VERSION" = latest || "$VERSION" = plexpass ]]; then +if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then VERSION=$PLEX_LATEST echo "Target version: $VERSION set by: latest\plexpass" else From 84ecc64b8fa15ee25f4287fa88b4d27e66979630 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Thu, 7 Apr 2016 08:45:34 +0200 Subject: [PATCH 10/15] Removal of any transcode mention. --- README.md | 2 -- init/15_fix_for_transcode.sh | 3 --- plexmediaserver | 3 --- 3 files changed, 8 deletions(-) delete mode 100644 init/15_fix_for_transcode.sh diff --git a/README.md b/README.md index bcdba3d..0fd0aa6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ docker create \ --net=host \ -e VERSION=plexpass \ -e PUID= -e PGID= \ - -v :/transcode \ -v :/config \ -v :/data/tvshows \ -v :/data/movies \ @@ -30,7 +29,6 @@ docker create \ * `--net=host` - Shares host networking with container, **required**. * `-v /config` - Plex library location. *This can grow very large, 50gb+ is likely for a large collection.* -* `-v /transcode` *(optional)* - Transcode directory to offload heavy writes in a docker container. * `-v /data/xyz` - Media goes here. Add as many as needed e.g. `/data/movies`, `/data/tv`, etc. * `-e VERSION=` - *(optional)* - Permits specific version selection e.g. `0.9.12.4.1192-9a47d21`, also supports `plexpass` or `latest` * `-e PGID=` for for GroupID - see below for explanation diff --git a/init/15_fix_for_transcode.sh b/init/15_fix_for_transcode.sh deleted file mode 100644 index b13e7a2..0000000 --- a/init/15_fix_for_transcode.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -chown -c abc:abc /transcode diff --git a/plexmediaserver b/plexmediaserver index 0df302f..071c896 100644 --- a/plexmediaserver +++ b/plexmediaserver @@ -6,9 +6,6 @@ PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6 # ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000 -# where the mediaserver should store the transcodes -PLEX_MEDIA_SERVER_TMPDIR=/transcode - # uncomment to set it to something else PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" From 62e4ee23722cfbb31ac9ac9c7df172e34312e6b9 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Thu, 7 Apr 2016 08:51:10 +0200 Subject: [PATCH 11/15] Added alternative for VERSION not being set. --- init/30_update_plex.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index 33d70e0..1dc209d 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -26,6 +26,7 @@ if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo " if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then VERSION=$PLEX_LATEST echo "Target version: $VERSION set by: latest\plexpass" +elif [[ -z "$VERSION" ]]; then else echo "Target version: $VERSION set by: manually" fi From 058e0beaac579a121b817f53c6596bd388da7973 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Thu, 7 Apr 2016 08:51:22 +0200 Subject: [PATCH 12/15] Edit for language --- init/30_update_plex.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index 1dc209d..e2b0e9d 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -27,6 +27,7 @@ if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then VERSION=$PLEX_LATEST echo "Target version: $VERSION set by: latest\plexpass" elif [[ -z "$VERSION" ]]; then + echo "Target version: Version not set, Defaulting to supplied version" else echo "Target version: $VERSION set by: manually" fi From 2c2d187c25ac60b5473e4bfae8231bb9b3c8e1bd Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Thu, 7 Apr 2016 09:18:45 +0200 Subject: [PATCH 13/15] added missing $ --- init/30_update_plex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index e2b0e9d..c4d4391 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -13,7 +13,7 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) #Get stuff from things. PLEX_TOKEN=$(cat "/config/Library/Application Support/Plex Media Server/Preferences.xml" | sed -n 's/.*PlexOnlineToken="//p' | sed "s/\".*//") -[ -z PLEX_TOKEN ] && echo "Plex token not avalible, please login " && exit 0 +[ -z $PLEX_TOKEN ] && echo "Plex token not avalible, please login " && exit 0 PLEX_LATEST=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) [ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" From d7dc8223125739bc9dc283bced182bccee38f1f8 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Thu, 7 Apr 2016 09:36:37 +0200 Subject: [PATCH 14/15] Atempt of remove UUOC --- init/30_update_plex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index c4d4391..bd53be3 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -12,7 +12,7 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) #Get stuff from things. -PLEX_TOKEN=$(cat "/config/Library/Application Support/Plex Media Server/Preferences.xml" | sed -n 's/.*PlexOnlineToken="//p' | sed "s/\".*//") +PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' "/config/Library/Application Support/Plex Media Server/Preferences.xml" | sed "s/\".*//") [ -z $PLEX_TOKEN ] && echo "Plex token not avalible, please login " && exit 0 PLEX_LATEST=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) From c7e8bf9495e0f91852ebde7440ffa11da5276e72 Mon Sep 17 00:00:00 2001 From: Stian Buch Larsen Date: Thu, 7 Apr 2016 09:39:04 +0200 Subject: [PATCH 15/15] Fix For SC2086. This makes code mergable --- init/30_update_plex.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/30_update_plex.sh b/init/30_update_plex.sh index bd53be3..6239ad7 100644 --- a/init/30_update_plex.sh +++ b/init/30_update_plex.sh @@ -13,7 +13,7 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) #Get stuff from things. PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' "/config/Library/Application Support/Plex Media Server/Preferences.xml" | sed "s/\".*//") -[ -z $PLEX_TOKEN ] && echo "Plex token not avalible, please login " && exit 0 +[ -z "$PLEX_TOKEN" ] && echo "Plex token not avalible, please login " && exit 0 PLEX_LATEST=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) [ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION"