docker-plex-wireguard/init/30_update_plex.sh

39 lines
1.3 KiB
Bash
Raw Normal View History

2015-05-10 10:50:00 +02:00
#!/bin/bash
# opt out for autoupdates
[ "$ADVANCED_DISABLEUPDATES" ] && exit 0
2015-05-10 10:50:00 +02:00
export DEBIAN_FRONTEND=noninteractive
2015-08-28 12:36:53 +02:00
while ! ping -c1 tools.linuxserver.io &>/dev/null; do :; done
2015-11-13 11:19:07 +00:00
#The following error is not an error.
2015-10-13 23:20:52 +02:00
INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
2015-08-28 12:36:53 +02:00
2015-09-24 09:25:27 +02:00
[ "$PLEXPASS" ] && echo "PLEXPASS is deprecated, please use VERSION"
2015-08-28 12:36:53 +02:00
if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then
2015-07-19 22:33:48 +02:00
VERSION=$(curl -s https://tools.linuxserver.io/latest-plexpass.json | grep "version" | cut -d '"' -f 4)
2015-11-13 11:19:07 +00:00
echo "Using version: $VERSION from Plexpass latest"
2015-08-28 12:36:53 +02:00
elif [[ $VERSION = "latest" || -z $VERSION ]]; then
2015-07-19 22:33:48 +02:00
VERSION=$(curl -s https://tools.linuxserver.io/latest-plex.json| grep "version" | cut -d '"' -f 4)
2015-11-13 11:19:07 +00:00
echo "Using version: $VERSION from Public latest"
2015-08-28 12:36:53 +02:00
else
2015-11-13 11:19:07 +00:00
echo "Using version: $VERSION from Manual"
2015-05-10 10:50:00 +02:00
fi
2015-08-28 12:36:53 +02:00
last=130
if [[ "$VERSION" != "$INSTALLED" ]]; then
2015-11-13 11:19:07 +00:00
echo "Upgrading from version: $INSTALLED to version: $VERSION"
2015-09-24 09:25:27 +02:00
while [[ $last -ne "0" ]]; do
rm -f /tmp/plexmediaserver_*.deb
wget -P /tmp "https://downloads.plex.tv/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb"
2015-09-24 09:25:27 +02:00
last=$?
2015-08-28 12:46:13 +02:00
done
2015-08-28 13:59:01 +02:00
apt-get remove --purge -y plexmediaserver
2015-09-24 09:25:27 +02:00
gdebi -n /tmp/plexmediaserver_"${VERSION}"_amd64.deb
2015-08-28 12:46:13 +02:00
else
2015-09-24 09:25:27 +02:00
echo "No need to update!"
2015-08-28 12:46:13 +02:00
fi
cp -v /defaults/plexmediaserver /etc/default/plexmediaserver