refined update script, not tested the logic fully yet

pull/53/head
sparklyballs 8 years ago
parent f1cdb88e51
commit 6dc05aafbc

@ -1,16 +1,24 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# set no update message # set no update message
[[ -e /tmp/no-version.nfo ]] && \
rm /tmp/no-version.nfo
NOVERSION_SET='/tmp/no-version.nfo'
cat > "${NOVERSION_SET}" <<-EOFVERSION
####################################################### #######################################################
# Update routine will not run, this is either because # # Update routine will not run because you havent set #
# you havent set the VERSION variable or have set # # the VERSION variable, for more information checkout #
# $ADVANCED_DISABLEUPDATES, for more information, see # #  https://github.com/linuxserver/docker-plex #
# <link not placed yet> #
####################################################### #######################################################
EOFVERSION
# test for no version set or opt out for autoupdates # test for no version set or opt out for autoupdates
[[ "$ADVANCED_DISABLEUPDATES" ]] && \ if [[ -z "$VERSION" ]] || [[ "$VERSION"=="0" ]] || [ "$ADVANCED_DISABLEUPDATES" ]; then
exit 0 echo "$(cat /tmp/no-version.nfo)"
exit 0
fi
# set header for no preferences/token message # set header for no preferences/token message
[[ -e /tmp/no-token.nfo ]] && \ [[ -e /tmp/no-token.nfo ]] && \
@ -59,27 +67,23 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
# start update routine # start update routine
[ "$PLEXPASS" ] && \ [[ "$PLEXPASS" ]] && \
echo "PLEXPASS is deprecated, please use VERSION" 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 deprecated please use version latest"; fi
if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then
VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 ) VERSION=$(curl -s "${PLEX_URL}/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 to: latest\plexpass"
elif [[ "$VERSION" = public ]]; then elif [[ "$VERSION" = public ]]; then
VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 ) VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 )
echo "Target version: $VERSION set by: public" echo "Target version: $VERSION set to: public"
elif [[ -z "$VERSION" ]]; then
echo "Target version: Version not set, Defaulting to supplied version"
else else
echo "Target version: $VERSION set by: manually" echo "Target version: $VERSION set to: manual"
fi fi
last=130 last=130
if [[ "$VERSION" == "" ]]; then if [[ "$VERSION" != "$INSTALLED" ]]; then
echo "VERSION variable not set, current installed version $INSTALLED"
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
@ -98,4 +102,3 @@ else
fi fi
cp -v /defaults/plexmediaserver /etc/default/plexmediaserver cp -v /defaults/plexmediaserver /etc/default/plexmediaserver

Loading…
Cancel
Save