From 5b48540a5d703526d9bf34470fd0fcdc45f8a352 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 1 Aug 2016 14:45:26 +0100 Subject: [PATCH] variable for plex download location, since they have a habit of changing it --- Dockerfile | 3 ++- root/etc/cont-init.d/30-plex-update | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2a84f90..ea45056 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ FROM lsiobase/xenial MAINTAINER Stian Larsen, sparklyballs # package version -ARG PLEX_WWW="https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" +ENV PLEX_URL="https://plex.tv/downloads" +ARG PLEX_WWW="${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu" # global environment settings ENV DEBIAN_FRONTEND="noninteractive" diff --git a/root/etc/cont-init.d/30-plex-update b/root/etc/cont-init.d/30-plex-update index ef3a085..d19c5ad 100644 --- a/root/etc/cont-init.d/30-plex-update +++ b/root/etc/cont-init.d/30-plex-update @@ -54,10 +54,10 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then - VERSION=$(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 ) + VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) echo "Target version: $VERSION set by: latest\plexpass" elif [[ "$VERSION" = public ]]; then - VERSION=$(curl -s "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 ) + VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 ) echo "Target version: $VERSION set by: public" elif [[ -z "$VERSION" ]]; then echo "Target version: Version not set, Defaulting to supplied version" @@ -71,8 +71,9 @@ if [[ "$VERSION" == "" ]]; then elif [[ "$VERSION" != "$INSTALLED" ]]; then echo "Upgrading from version: $INSTALLED to version: $VERSION" while [[ $last -ne "0" ]]; do - rm -f /tmp/plexmediaserver_*.deb - wget -P /tmp "https://downloads.plex.tv/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" + rm -f /tmp/plexmediaserver_*.deb + curl -o /tmp/plexmediaserver_"${VERSION}"_amd64.deb -L \ + "${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" last=$? done [[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && exit 0