@@ -10,18 +10,31 @@ while ! ping -c1 tools.linuxserver.io &>/dev/null; do :; done
1010# The following error is not an error.
1111INSTALLED=$( dpkg-query -W -f=' ${Version}' plexmediaserver)
1212
13+
14+ # Get stuff from things.
15+ PLEX_TOKEN=$( sed -n ' s/.*PlexOnlineToken="//p' " /config/Library/Application Support/Plex Media Server/Preferences.xml" | sed " s/\" .*//" )
16+ [ -z " $PLEX_TOKEN " ] && echo " Plex token not avalible, please login " && exit 0
17+ 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 )
18+
1319[ " $PLEXPASS " ] && echo " PLEXPASS is deprecated, please use VERSION"
20+ if [[ -z $VERSION && " $PLEXPASS " == " 1" || $VERSION = " plexpass" ]]; then echo " VERSION=plexpass is depricated please use version latest" ; fi
21+
22+
23+ # Start update rutine
1424
15- if [[ -z $VERSION && " $PLEXPASS " == " 1 " || $VERSION = " plexpass " ]] ; then
16- VERSION= $( curl -s https://tools.linuxserver.io/ latest-plexpass.json | grep " version " | cut -d ' " ' -f 4 )
17- echo " Using version: $ VERSION from Plexpass latest "
18- elif [[ $VERSION = " latest " || -z $VERSION ]] ; then
19- VERSION= $( curl -s https://tools.linuxserver.io/latest-plex.json | grep " version " | cut -d ' " ' -f 4 )
20- echo " Using version: $VERSION from Public latest "
25+
26+ if [[ " $ VERSION" = latest || " $VERSION " = plexpass ]] ; then
27+ VERSION= $PLEX_LATEST
28+ echo " Target version: $VERSION set by: latest\plexpass "
29+ elif [[ -z " $VERSION " ]] ; then
30+ echo " Target version: Version not set, Defaulting to supplied version "
2131else
22- echo " Using version: $VERSION from Manual "
32+ echo " Target version: $VERSION set by: manually "
2333fi
2434
35+
36+
37+
2538last=130
2639if [[ " $VERSION " == " " ]]; then
2740 echo " ERROR: No version found, running installed version $INSTALLED "
@@ -33,7 +46,7 @@ elif [[ "$VERSION" != "$INSTALLED" ]]; then
3346 last=$?
3447 done
3548 apt-get remove --purge -y plexmediaserver
36- gdebi -n /tmp/plexmediaserver_" ${VERSION} " _amd64.deb
49+ dpkg -i /tmp/plexmediaserver_" ${VERSION} " _amd64.deb
3750else
3851 echo " No need to update!"
3952fi
0 commit comments