|
|
@ -1,10 +1,12 @@
|
|
|
|
#!/usr/bin/with-contenv bash
|
|
|
|
#!/usr/bin/with-contenv bash
|
|
|
|
|
|
|
|
|
|
|
|
# opt out for autoupdates
|
|
|
|
# opt out for autoupdates
|
|
|
|
[ "$ADVANCED_DISABLEUPDATES" ] && exit 0
|
|
|
|
[ "$ADVANCED_DISABLEUPDATES" ] && \
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
|
|
|
|
# set header for no preferences/token message
|
|
|
|
# set header for no preferences/token message
|
|
|
|
[[ -e /tmp/no-token.nfo ]] && rm /tmp/no-token.nfo
|
|
|
|
[[ -e /tmp/no-token.nfo ]] && \
|
|
|
|
|
|
|
|
rm /tmp/no-token.nfo
|
|
|
|
NOTOKEN_SET='/tmp/no-token.nfo'
|
|
|
|
NOTOKEN_SET='/tmp/no-token.nfo'
|
|
|
|
cat > "${NOTOKEN_SET}" <<-EOFTOKEN
|
|
|
|
cat > "${NOTOKEN_SET}" <<-EOFTOKEN
|
|
|
|
|
|
|
|
|
|
|
@ -28,8 +30,8 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
# attempt to read plex token
|
|
|
|
# attempt to read plex token
|
|
|
|
PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \
|
|
|
|
PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \
|
|
|
|
"/config/Library/Application Support/Plex Media Server/Preferences.xml" \
|
|
|
|
"/config/Library/Application Support/Plex Media Server/Preferences.xml" \
|
|
|
|
| sed "s/\".*//")
|
|
|
|
| sed "s/\".*//")
|
|
|
|
|
|
|
|
|
|
|
|
# if plex token isn't found, exit out
|
|
|
|
# if plex token isn't found, exit out
|
|
|
|
if [ -z "$PLEX_TOKEN" ]; then
|
|
|
|
if [ -z "$PLEX_TOKEN" ]; then
|
|
|
@ -39,7 +41,7 @@ cat >> "${NOTOKEN_SET}" <<-EOFTOKEN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EOFTOKEN
|
|
|
|
EOFTOKEN
|
|
|
|
less /tmp/no-token.nfo
|
|
|
|
echo "$(cat /tmp/no-token.nfo)"
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -49,7 +51,8 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
|
|
|
|
|
|
|
|
|
|
|
|
# start update routine
|
|
|
|
# start update routine
|
|
|
|
|
|
|
|
|
|
|
|
[ "$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
|
|
|
|
|
|
|
|
|
|
|
@ -67,18 +70,21 @@ fi
|
|
|
|
|
|
|
|
|
|
|
|
last=130
|
|
|
|
last=130
|
|
|
|
if [[ "$VERSION" == "" ]]; then
|
|
|
|
if [[ "$VERSION" == "" ]]; then
|
|
|
|
echo "VERSION variable not set, current installed version $INSTALLED"
|
|
|
|
echo "VERSION variable not set, current installed version $INSTALLED"
|
|
|
|
elif [[ "$VERSION" != "$INSTALLED" ]]; then
|
|
|
|
elif [[ "$VERSION" != "$INSTALLED" ]]; then
|
|
|
|
echo "Upgrading from version: $INSTALLED to version: $VERSION"
|
|
|
|
echo "Upgrading from version: $INSTALLED to version: $VERSION"
|
|
|
|
while [[ $last -ne "0" ]]; do
|
|
|
|
while [[ $last -ne "0" ]]; do
|
|
|
|
rm -f /tmp/plexmediaserver_*.deb
|
|
|
|
rm -f /tmp/plexmediaserver_*.deb
|
|
|
|
curl -o /tmp/plexmediaserver_"${VERSION}"_amd64.deb -L \
|
|
|
|
curl -o /tmp/plexmediaserver_"${VERSION}"_amd64.deb -L \
|
|
|
|
"${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb"
|
|
|
|
"${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb"
|
|
|
|
last=$?
|
|
|
|
last=$?
|
|
|
|
done
|
|
|
|
done
|
|
|
|
[[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && exit 0
|
|
|
|
[[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && \
|
|
|
|
apt-get remove --purge -y plexmediaserver
|
|
|
|
exit 0
|
|
|
|
dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb
|
|
|
|
apt-get remove --purge -y \
|
|
|
|
|
|
|
|
plexmediaserver
|
|
|
|
|
|
|
|
dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "No need to update!"
|
|
|
|
echo "No need to update!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|