From b2c4f8109adb424cfb76068d4f7e9854cb8321a1 Mon Sep 17 00:00:00 2001 From: Graham Booker <gbooker@plexapp.com> Date: Mon, 12 Dec 2016 10:41:27 -0600 Subject: [PATCH] Changed `latest`->`plexpass` to allow latest to be tagged to a version. Also the updater always behaves how the image was tagged at build. --- Dockerfile | 5 ++--- root/etc/cont-init.d/50-plex-update | 15 ++++++++------- root/installBinary.sh | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 09b46587..dd20ff3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,12 +41,11 @@ RUN \ EXPOSE 32400/tcp 3005/tcp 8324/tcp 32469/tcp 1900/udp 32410/udp 32412/udp 32413/udp 32414/udp VOLUME /config /transcode -ENV VERSION=latest \ - CHANGE_DIR_RIGHTS="false" \ +ENV CHANGE_DIR_RIGHTS="false" \ CHANGE_CONFIG_DIR_OWNERSHIP="true" \ HOME="/config" -ARG TAG=latest +ARG TAG=plexpass COPY root/ / diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index db4e2709..c192d3f3 100755 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -25,23 +25,24 @@ else fi # Read set version -if [ -e /version.txt ]; then - VERSION="$(cat /version.txt)" - echo "Setting version to ${VERSION} per container configuration" +versionToInstall="$(cat /version.txt)" +if [ -z "${versionToInstall}" ]; then + echo "No version specified in install. Broken image" + exit 1 fi # Short-circuit test of version before remote check to see if it's already installed. -if [ "${VERSION}" = "${installedVersion}" ]; then +if [ "${versionToInstall}" = "${installedVersion}" ]; then exit 0 fi # Get updated version number -if [ "${VERSION,,}" = "latest" ]; then +if [ "${versionToInstall,,}" = "plexpass" ]; then versionInfo="$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=8&distro=ubuntu&X-Plex-Token=${token}")" -elif [ "${VERSION,,}" = "public" ]; then +elif [ "${versionToInstall,,}" = "public" ]; then versionInfo="$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu")" else - versionInfo="$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=8&distro=ubuntu&X-Plex-Token=${token}&version=${VERSION}")" + versionInfo="$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=8&distro=ubuntu&X-Plex-Token=${token}&version=${versionToInstall}")" fi if [ -z "${versionInfo}" ]; then diff --git a/root/installBinary.sh b/root/installBinary.sh index f20392b1..24dbd8db 100755 --- a/root/installBinary.sh +++ b/root/installBinary.sh @@ -1,7 +1,7 @@ #!/bin/bash -if [ "${TAG}" != "latest" ] && [ "${TAG}" != "public" ]; then - echo "${TAG}" > /version.txt +echo "${TAG}" > /version.txt +if [ "${TAG}" != "plexpass" ] && [ "${TAG}" != "public" ]; then versionInfo="$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=8&distro=ubuntu&X-Plex-Token=${token}&version=${TAG}")" remoteVersion=$(echo "${versionInfo}" | sed -n 's/.*Release.*version="\([^"]*\)".*/\1/p') remoteFile=$(echo "${versionInfo}" | sed -n 's/.*file="\([^"]*\)".*/\1/p')