Skip to content

Commit 6dc05aa

Browse files
committed
refined update script, not tested the logic fully yet
1 parent f1cdb88 commit 6dc05aa

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

root/etc/cont-init.d/50-plex-update

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
#!/usr/bin/with-contenv bash
22

33
# set no update message
4+
[[ -e /tmp/no-version.nfo ]] && \
5+
rm /tmp/no-version.nfo
6+
NOVERSION_SET='/tmp/no-version.nfo'
7+
cat > "${NOVERSION_SET}" <<-EOFVERSION
8+
9+
410
#######################################################
5-
# Update routine will not run, this is either because #
6-
# you havent set the VERSION variable or have set #
7-
# $ADVANCED_DISABLEUPDATES, for more information, see #
8-
# <link not placed yet> #
11+
# Update routine will not run because you havent set #
12+
# the VERSION variable, for more information checkout #
13+
#  https://github.com/linuxserver/docker-plex #
914
#######################################################
15+
EOFVERSION
1016

1117
# test for no version set or opt out for autoupdates
12-
[[ "$ADVANCED_DISABLEUPDATES" ]] && \
13-
exit 0
18+
if [[ -z "$VERSION" ]] || [[ "$VERSION"=="0" ]] || [ "$ADVANCED_DISABLEUPDATES" ]; then
19+
echo "$(cat /tmp/no-version.nfo)"
20+
exit 0
21+
fi
1422

1523
# set header for no preferences/token message
1624
[[ -e /tmp/no-token.nfo ]] && \
@@ -59,27 +67,23 @@ INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
5967

6068
# start update routine
6169

62-
[ "$PLEXPASS" ] && \
70+
[[ "$PLEXPASS" ]] && \
6371
echo "PLEXPASS is deprecated, please use VERSION"
6472

65-
if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is depricated please use version latest"; fi
73+
if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is deprecated please use version latest"; fi
6674

6775
if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then
6876
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 )
69-
echo "Target version: $VERSION set by: latest\plexpass"
77+
echo "Target version: $VERSION set to: latest\plexpass"
7078
elif [[ "$VERSION" = public ]]; then
7179
VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 )
72-
echo "Target version: $VERSION set by: public"
73-
elif [[ -z "$VERSION" ]]; then
74-
echo "Target version: Version not set, Defaulting to supplied version"
80+
echo "Target version: $VERSION set to: public"
7581
else
76-
echo "Target version: $VERSION set by: manually"
82+
echo "Target version: $VERSION set to: manual"
7783
fi
7884

7985
last=130
80-
if [[ "$VERSION" == "" ]]; then
81-
echo "VERSION variable not set, current installed version $INSTALLED"
82-
elif [[ "$VERSION" != "$INSTALLED" ]]; then
86+
if [[ "$VERSION" != "$INSTALLED" ]]; then
8387
echo "Upgrading from version: $INSTALLED to version: $VERSION"
8488
while [[ $last -ne "0" ]]; do
8589
rm -f /tmp/plexmediaserver_*.deb
@@ -98,4 +102,3 @@ else
98102
fi
99103

100104
cp -v /defaults/plexmediaserver /etc/default/plexmediaserver
101-

0 commit comments

Comments
 (0)