Skip to content

Commit 5db417d

Browse files
committed
save up for prosperity, no comment on completion or viability, just a save up
1 parent 78f96a9 commit 5db417d

2 files changed

Lines changed: 21 additions & 25 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ RUN \
2626
# cleanup
2727
apt-get clean && \
2828
rm -rf \
29+
/etc/default/plexmediaserver \
2930
/tmp/* \
3031
/var/lib/apt/lists/* \
3132
/var/tmp/*

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

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

3+
# copy config on first run, regardless of update status
4+
[[ ! -e /etc/default/plexmediaserver ]] && \
5+
cp /defaults/plexmediaserver /etc/default/plexmediaserver
6+
37
# set no update message
48
[[ -e /tmp/no-version.nfo ]] && \
5-
rm /tmp/no-version.nfo
9+
rm /tmp/no-version.nfo
610
NOVERSION_SET='/tmp/no-version.nfo'
711
cat > "${NOVERSION_SET}" <<-EOFVERSION
812

@@ -61,39 +65,30 @@ fi
6165
INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
6266

6367
# start update routine
64-
65-
[[ "$PLEXPASS" ]] && \
66-
echo "PLEXPASS is deprecated, please use VERSION"
67-
68-
if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "VERSION=plexpass is deprecated please use version latest"; fi
69-
70-
if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then
71-
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 )
72-
echo "Target version: $VERSION"
73-
elif [[ "$VERSION" = public ]]; then
74-
VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 )
75-
echo "Target version: $VERSION"
68+
if [[ "$VERSION" = latest ]] || [[ "$VERSION" = plexpass ]] || [[ "$PLEXPASS" == "1" ]]; then
69+
PLEX_TOKEN="${PLEX_TOKEN}"
7670
else
77-
echo "Target version: $VERSION"
71+
PLEX_TOKEN=""
7872
fi
73+
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 )
7974

75+
if [[ "$VERSION" == "$INSTALLED" ]]; then
76+
echo "No update required"
77+
exit 0
78+
fi
79+
80+
echo "Atempting to upgrade to: $VERSION"
8081
last=130
81-
if [[ "$VERSION" != "$INSTALLED" ]]; then
82-
echo "Upgrading from version: $INSTALLED to version: $VERSION"
83-
while [[ $last -ne "0" ]]; do
82+
while [[ $last -ne "0" ]]; do
8483
rm -f /tmp/plexmediaserver_*.deb
8584
curl -o /tmp/plexmediaserver_"${VERSION}"_amd64.deb -L \
8685
"${PLEX_URL}/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb"
8786
last=$?
88-
done
89-
[[ ! -e /tmp/plexmediaserver_"${VERSION}"_amd64.deb ]] && \
90-
exit 0
87+
done
9188
apt-get remove --purge -y \
9289
plexmediaserver
93-
dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb
94-
rm -f /tmp/plexmediaserver_*.deb
95-
else
96-
echo "No updates found!"
97-
fi
90+
dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb
91+
rm -f /tmp/plexmediaserver_*.deb
9892

93+
# recopy config file in case update overwrites our copy
9994
cp -v /defaults/plexmediaserver /etc/default/plexmediaserver

0 commit comments

Comments
 (0)