Skip to content

Commit 960aa1d

Browse files
committed
move test for plex installed to top of update script, change dpkg options
1 parent 77f0ea6 commit 960aa1d

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
[[ ! -e /etc/default/plexmediaserver ]] && \
55
cp /defaults/plexmediaserver /etc/default/plexmediaserver
66

7+
# test if plex is installed and try re-pulling latest if not
8+
if dpkg -s plexmediaserver > /dev/null 2>&1 ; then
9+
:
10+
else echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script"
11+
curl -o /tmp/plexmediaserver.deb -L \
12+
"${PLEX_INSTALL}" && \
13+
dpkg -i --force-confold /tmp/plexmediaserver.deb
14+
rm -f /tmp/plexmediaserver.deb
15+
exit 0
16+
fi
17+
718
# set no update message
819
[[ -e /tmp/no-version.nfo ]] && \
920
rm /tmp/no-version.nfo
@@ -102,13 +113,9 @@ printf "\n\n\n%s\n\n\n" "$(</tmp/update_fail.nfo)"
102113
exit 0
103114
# if ok, try to install it.
104115
else
105-
dpkg -i /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb
116+
dpkg -i --force-confold /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb
106117
rm -f /tmp/plexmediaserver_*.deb
107118
fi
108119

109-
# test if plex is installed and try re-pulling latest if not
110-
dpkg -s plexmediaserver > /dev/null 2>&1 || \
111-
(echo "for some reason the update has failed and plex doesn't seem to be installed, retrying a known version" && curl -o /tmp/plexmediaserver.deb -L "${PLEX_INSTALL}" && dpkg -i /tmp/plexmediaserver.deb)
112-
113-
# recopy config file in case update overwrites our copy
120+
# recopy config file
114121
cp /defaults/plexmediaserver /etc/default/plexmediaserver

0 commit comments

Comments
 (0)