still working on update script

pull/52/head
sparklyballs 8 years ago
parent da12aa2d63
commit 78f96a9629

@ -15,8 +15,8 @@ cat > "${NOVERSION_SET}" <<-EOFVERSION
EOFVERSION
# test for no version set or opt out for autoupdates
if [ -z "$VERSION" -o "$VERSION" == "0" -o ! -z "$ADVANCED_DISABLEUPDATES" ]; then
echo "$(cat /tmp/no-version.nfo)"
if [[ -z "$VERSION" ]] || [[ "$VERSION" == "0" ]] || [[ ! -z "$ADVANCED_DISABLEUPDATES" ]]; then
printf "%s\n\n\n" "$(</tmp/no-version.nfo)"
exit 0
fi
@ -37,10 +37,8 @@ if [ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml
cat >> "${NOTOKEN_SET}" <<-EOFTOKEN
# preference file found, possibly first startup. #
#####################################################
EOFTOKEN
echo "$(cat /tmp/no-token.nfo)"
printf "%s\n\n\n" "$(</tmp/no-token.nfo)"
exit 0
fi
@ -54,17 +52,14 @@ if [ -z "$PLEX_TOKEN" ]; then
cat >> "${NOTOKEN_SET}" <<-EOFTOKEN
# plex token found in the preference file #
#####################################################
EOFTOKEN
echo "$(cat /tmp/no-token.nfo)"
printf "%s\n\n\n" "$(</tmp/no-token.nfo)"
exit 0
fi
# determine installed version of plex
INSTALLED=$(dpkg-query -W -f='${Version}' plexmediaserver)
# start update routine
[[ "$PLEXPASS" ]] && \
@ -74,12 +69,12 @@ if [[ -z $VERSION && "$PLEXPASS" == "1" || $VERSION = "plexpass" ]]; then echo "
if [[ "$VERSION" = latest || "$VERSION" = plexpass ]]; then
VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=$PLEX_TOKEN"| cut -d "/" -f 5 )
echo "Target version: $VERSION set to: latest\plexpass"
echo "Target version: $VERSION"
elif [[ "$VERSION" = public ]]; then
VERSION=$(curl -s "${PLEX_URL}/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token="| cut -d "/" -f 5 )
echo "Target version: $VERSION set to: public"
echo "Target version: $VERSION"
else
echo "Target version: $VERSION set to: manual"
echo "Target version: $VERSION"
fi
last=130
@ -96,9 +91,9 @@ if [[ "$VERSION" != "$INSTALLED" ]]; then
apt-get remove --purge -y \
plexmediaserver
dpkg -i /tmp/plexmediaserver_"${VERSION}"_amd64.deb
rm -f /tmp/plexmediaserver_*.deb
else
echo "No need to update!"
echo "No updates found!"
fi
cp -v /defaults/plexmediaserver /etc/default/plexmediaserver

Loading…
Cancel
Save