working on plex update script
This commit is contained in:
parent
37eab12ea3
commit
5888cf11be
2 changed files with 43 additions and 11 deletions
|
|
@ -11,6 +11,7 @@ RUN \
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
avahi-daemon \
|
avahi-daemon \
|
||||||
dbus \
|
dbus \
|
||||||
|
less \
|
||||||
wget && \
|
wget && \
|
||||||
# cleanup
|
# cleanup
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
|
|
|
||||||
|
|
@ -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.
|
|
||||||
|
#####################################################
|
||||||
|
# Login via webui and restart, because there was no #
|
||||||
|
EOFTOKEN
|
||||||
|
|
||||||
|
# if preferences files doesn't exist, exit out
|
||||||
|
if [ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]; then
|
||||||
|
cat >> "${NOTOKEN_SET}" <<-EOFTOKEN
|
||||||
|
# preference file found, possibly first startup. #
|
||||||
|
#####################################################
|
||||||
|
|
||||||
|
|
||||||
|
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/\".*//")
|
||||||
|
|
||||||
|
# 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)
|
INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
|
||||||
|
|
||||||
|
|
||||||
#Get stuff from things.
|
# start update routine
|
||||||
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
|
|
||||||
|
|
||||||
[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION"
|
[ "$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 [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi
|
||||||
|
|
||||||
|
|
||||||
#Start update rutine
|
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue