|
|
|
@ -10,18 +10,31 @@ while ! ping -c1 tools.linuxserver.io &>/dev/null; do :; done
|
|
|
|
|
#The following error is not an error.
|
|
|
|
|
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
|
|
|
|
|
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 [[ -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"
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
|
|
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 "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"
|
|
|
|
@ -33,7 +46,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
|
|
|
|
|