Total Revamp of update code.

pull/8/head
Stian Buch Larsen 9 years ago
parent 1dc6116ebb
commit 5c13966493

@ -1,20 +1,52 @@
#!/bin/bash #!/bin/bash
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
INSTALLED=`dpkg-query -W -f='${Version}' plexmediaserver`
if [ $VERSION ]; then
echo "Useing version: $VERSION from Manual"
elif [ "$PLEXPASS" == "1" ]; then if [[ "$PLEXPASS" ]]; then
echo "PLEXPASS is depricated, please use VERSION"
fi
if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then
VERSION=$(curl -s https://tools.linuxserver.io/latest-plexpass.json | grep "version" | cut -d '"' -f 4) VERSION=$(curl -s https://tools.linuxserver.io/latest-plexpass.json | grep "version" | cut -d '"' -f 4)
echo "Useing version: $VERSION from Plexpass latest" echo "Useing version: $VERSION from Plexpass latest"
else elif [[ $VERSION = "latest" || -z $VERSION ]]; then
VERSION=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "version" | cut -d '"' -f 4) VERSION=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "version" | cut -d '"' -f 4)
echo "Useing version: $VERSION from Public latest" echo "Useing version: $VERSION from Public latest"
else
echo "Useing version: $VERSION from Manual"
fi fi
if [ "$VERSION" == "$INSTALLED" ]; then
exit 0; last=130
fi
mv /etc/default/plexmediaserver /tmp/ while [ last -ne "0"]; do
rm -f /tmp/plexmediaserver_*.deb
wget -P /tmp "http://downloads.plexapp.com/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb"
last=$?
done
apt-get remove --purge -y plexmediaserver 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 gdebi -n /tmp/plexmediaserver_${VERSION}_amd64.deb
mv /tmp/plexmediaserver /etc/default/
# 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/

Loading…
Cancel
Save