|
|
@ -3,22 +3,55 @@
|
|
|
|
# opt out for autoupdates
|
|
|
|
# opt out for autoupdates
|
|
|
|
[ "$ADVANCED_DISABLEUPDATES" ] && exit 0
|
|
|
|
[ "$ADVANCED_DISABLEUPDATES" ] && exit 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# set header for no preferences/token message
|
|
|
|
|
|
|
|
[[ -e /tmp/no-token.nfo ]] && rm /tmp/no-token.nfo
|
|
|
|
|
|
|
|
NOTOKEN_SET='/tmp/no-token.nfo'
|
|
|
|
|
|
|
|
cat > "${NOTOKEN_SET}" <<-EOFTOKEN
|
|
|
|
|
|
|
|
|
|
|
|
#The following error is not an error.
|
|
|
|
|
|
|
|
INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#####################################################
|
|
|
|
|
|
|
|
# Login via webui and restart, because there was no #
|
|
|
|
|
|
|
|
EOFTOKEN
|
|
|
|
|
|
|
|
|
|
|
|
#Get stuff from things.
|
|
|
|
# if preferences files doesn't exist, exit out
|
|
|
|
PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' "/config/Library/Application Support/Plex Media Server/Preferences.xml" | sed "s/\".*//")
|
|
|
|
if [ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]; then
|
|
|
|
[ -z "$PLEX_TOKEN" ] && echo "Plex token not avalible, please login " && exit 0
|
|
|
|
cat >> "${NOTOKEN_SET}" <<-EOFTOKEN
|
|
|
|
|
|
|
|
# preference file found, possibly first startup. #
|
|
|
|
|
|
|
|
#####################################################
|
|
|
|
|
|
|
|
|
|
|
|
[ "$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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EOFTOKEN
|
|
|
|
|
|
|
|
less /tmp/no-token.nfo
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# attempt to read plex token
|
|
|
|
|
|
|
|
PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \
|
|
|
|
|
|
|
|
"/config/Library/Application Support/Plex Media Server/Preferences.xml" \
|
|
|
|
|
|
|
|
| sed "s/\".*//")
|
|
|
|
|
|
|
|
|
|
|
|
#Start update rutine
|
|
|
|
# if plex token isn't found, exit out
|
|
|
|
|
|
|
|
if [ -z "$PLEX_TOKEN" ]; then
|
|
|
|
|
|
|
|
cat >> "${NOTOKEN_SET}" <<-EOFTOKEN
|
|
|
|
|
|
|
|
# plex token in the preferences file in config #
|
|
|
|
|
|
|
|
#####################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EOFTOKEN
|
|
|
|
|
|
|
|
less /tmp/no-token.nfo
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# determine installed version of plex
|
|
|
|
|
|
|
|
INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# start update routine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ "$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
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then
|
|
|
|
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 "https://plex.tv/downloads/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"
|
|
|
|
echo "Target version: $VERSION set by: latest\plexpass"
|
|
|
@ -31,9 +64,6 @@ else
|
|
|
|
echo "Target version: $VERSION set by: manually"
|
|
|
|
echo "Target version: $VERSION set by: manually"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
last=130
|
|
|
|
last=130
|
|
|
|
if [[ "$VERSION" == "" ]]; then
|
|
|
|
if [[ "$VERSION" == "" ]]; then
|
|
|
|
echo "ERROR: No version found, running installed version $INSTALLED"
|
|
|
|
echo "ERROR: No version found, running installed version $INSTALLED"
|
|
|
@ -49,5 +79,6 @@ elif [[ "$VERSION" != "$INSTALLED" ]]; then
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "No need to update!"
|
|
|
|
echo "No need to update!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
cp -v /defaults/plexmediaserver /etc/default/plexmediaserver
|
|
|
|
cp -v /defaults/plexmediaserver /etc/default/plexmediaserver
|
|
|
|
|
|
|
|
|
|
|
|