Added overriding of update channel for internal testing purposes.

This commit is contained in:
Graham Booker 2017-12-05 08:25:31 -06:00
parent 21664a6779
commit 8438f12d66
No known key found for this signature in database
GPG Key ID: 7FA620B73BAFAB5B

View File

@ -6,16 +6,26 @@ function getVersionInfo {
declare -n remoteVersion=$3
declare -n remoteFile=$4
local versionInfo
if [ "${version,,}" = "plexpass" ]; then
versionInfo="$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=8&distro=ubuntu&X-Plex-Token=${token}")"
local channel
local tokenNeeded=1
if [ ! -z "${PLEX_UPDATE_CHANNEL}" ] && [ "${PLEX_UPDATE_CHANNEL}" > 0 ]; then
channel="${PLEX_UPDATE_CHANNEL}"
elif [ "${version,,}" = "plexpass" ]; then
channel=8
elif [ "${version,,}" = "public" ]; then
versionInfo="$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu")"
channel=16
tokenNeeded=0
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}")"
channel=8
fi
local url="https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=${channel}&distro=ubuntu"
if [ ${tokenNeeded} -gt 0 ]; then
url="${url}&X-Plex-Token=${token}"
fi
local versionInfo="$(curl -s "${url}")"
# Get update info from the XML. Note: This could countain multiple updates when user specifies an exact version with the lowest first, so we'll use first always.
remoteVersion=$(echo "${versionInfo}" | sed -n 's/.*Release.*version="\([^"]*\)".*/\1/p')
remoteFile=$(echo "${versionInfo}" | sed -n 's/.*file="\([^"]*\)".*/\1/p')