From 61f92ad0eac508956de3e7ad22403e3939bd78c0 Mon Sep 17 00:00:00 2001 From: "Stian Larsen (lonix)" Date: Thu, 24 Sep 2015 09:25:27 +0200 Subject: [PATCH] Some cleanup --- init/20_update_plex.sh | 44 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 35 deletions(-) diff --git a/init/20_update_plex.sh b/init/20_update_plex.sh index e9029c4..7e0c2de 100644 --- a/init/20_update_plex.sh +++ b/init/20_update_plex.sh @@ -1,11 +1,9 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive - INSTALLED=`dpkg-query -W -f='${Version}' plexmediaserver` + INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver) -if [[ "$PLEXPASS" ]]; then - echo "PLEXPASS is depricated, please use VERSION" -fi +[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION" if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then VERSION=$(curl -s https://tools.linuxserver.io/latest-plexpass.json | grep "version" | cut -d '"' -f 4) @@ -19,39 +17,15 @@ fi last=130 if [[ "$VERSION" != "$INSTALLED" ]]; then - echo "Upgradeing from version: $INSTALLED to version: $VERSION" - while [[ $last -ne "0" ]]; do - rm -f /tmp/plexmediaserver_*.deb - wget -P /tmp "https://downloads.plexapp.com/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" - last=$? + echo "Upgradeing from version: $INSTALLED to version: $VERSION" + while [[ $last -ne "0" ]]; do + rm -f /tmp/plexmediaserver_*.deb + wget -P /tmp "https://downloads.plexapp.com/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" + last=$? done apt-get remove --purge -y plexmediaserver - gdebi -n /tmp/plexmediaserver_${VERSION}_amd64.deb + gdebi -n /tmp/plexmediaserver_"${VERSION}"_amd64.deb else - echo "Allready Uptodate" + echo "No need to update!" fi cp -v /defaults/plexmediaserver /etc/default/plexmediaserver - - - - - -# INSTALLED=`dpkg-query -W -f='${Version}' plexmediaserver` -# if [ $VERSION ]; then -# echo "Useing version: $VERSION from Manual" -# elif [ "$PLEXPASS" == "1" ]; then -# VERSION=$(curl -s https://tools.linuxserver.io/latest-plexpass.json | grep "version" | cut -d '"' -f 4) -# echo "Useing version: $VERSION from Plexpass latest" -# else -# VERSION=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "version" | cut -d '"' -f 4) -# echo "Useing version: $VERSION from Public latest" -# fi -# if [ "$VERSION" == "$INSTALLED" ]; then -# exit 0; -# fi -# mv /etc/default/plexmediaserver /tmp/ -# apt-get remove --purge -y plexmediaserver -# wget -P /tmp "http://downloads.plexapp.com/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" -# gdebi -n /tmp/plexmediaserver_${VERSION}_amd64.deb -# mv /tmp/plexmediaserver /etc/default/ -