From 1d6831d557617dfa18c13bd2988f8b485d640b10 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Tue, 23 Aug 2016 03:47:23 +0100 Subject: [PATCH] haven't quite sorted out better download error handling --- root/etc/cont-init.d/50-plex-update | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/root/etc/cont-init.d/50-plex-update b/root/etc/cont-init.d/50-plex-update index 62dd7d6..d53410b 100644 --- a/root/etc/cont-init.d/50-plex-update +++ b/root/etc/cont-init.d/50-plex-update @@ -92,15 +92,16 @@ fi echo "Atempting to upgrade to: $REMOTE_VERSION" last=130 -down_tries=3 -if curl --output /dev/null --silent --head --fail "${PLEX_URL}/plex-media-server/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb"; then -while [[ $last -ne "0" ]] || [[ down_tries -gt 0 ]]; do +down_tries=0 +while [[ $last -ne "0" ]]; do rm -f /tmp/plexmediaserver_*.deb curl -o /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb -L \ - "${PLEX_URL}/plex-media-server/$REMOTE_VERSION/plexmediaserver_${REMOTE_VERSION}_amd64.deb" - down_tries=$((down_tries-1)) -last=$? + "${PLEX_URL}/plex-media-server/${REMOTE_VERSION}/plexmediaserver_${REMOTE_VERSION}_amd64.deb" + last=$? done + +# test if deb exists, install it or exit out +if [[ $(stat -c %s /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb) -gt 10000 ]]; then apt-get remove --purge -y \ plexmediaserver dpkg -i /tmp/plexmediaserver_"${REMOTE_VERSION}"_amd64.deb