better test for package installed or not.

pull/54/head
sparklyballs 8 years ago committed by GitHub
parent fd5f6217eb
commit 7fd2f7f574

@ -2,14 +2,15 @@
# copy config on first run, regardless of update status # copy config on first run, regardless of update status
[[ ! -e /etc/default/plexmediaserver ]] && \ [[ ! -e /etc/default/plexmediaserver ]] && \
cp /defaults/plexmediaserver /etc/default/plexmediaserver cp /defaults/plexmediaserver /etc/default/plexmediaserver
# test if plex is installed and try re-pulling latest if not # test if plex is installed and try re-pulling latest if not
if dpkg -s plexmediaserver > /dev/null 2>&1 ; then if (dpkg --get-selections plexmediaserver | grep -wq "install"); then
: :
else echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script" else
echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script"
curl -o /tmp/plexmediaserver.deb -L \ curl -o /tmp/plexmediaserver.deb -L \
"${PLEX_INSTALL}" && \ "${PLEX_INSTALL}" && \
dpkg -i --force-confold /tmp/plexmediaserver.deb dpkg -i --force-confold /tmp/plexmediaserver.deb
rm -f /tmp/plexmediaserver.deb rm -f /tmp/plexmediaserver.deb
exit 0 exit 0
@ -17,7 +18,7 @@ fi
# set no update message # set no update message
[[ -e /tmp/no-version.nfo ]] && \ [[ -e /tmp/no-version.nfo ]] && \
rm /tmp/no-version.nfo rm /tmp/no-version.nfo
NOVERSION_SET='/tmp/no-version.nfo' NOVERSION_SET='/tmp/no-version.nfo'
cat > "${NOVERSION_SET}" <<-EOFVERSION cat > "${NOVERSION_SET}" <<-EOFVERSION
####################################################### #######################################################
@ -30,7 +31,7 @@ EOFVERSION
# set update failed message # set update failed message
[[ -e /tmp/update_fail.nfo ]] && \ [[ -e /tmp/update_fail.nfo ]] && \
rm /tmp/update_fail.nfo rm /tmp/update_fail.nfo
UPGRADE_FAIL='/tmp/update_fail.nfo' UPGRADE_FAIL='/tmp/update_fail.nfo'
cat > "${UPGRADE_FAIL}" <<-EOFFAIL cat > "${UPGRADE_FAIL}" <<-EOFFAIL
######################################################## ########################################################
@ -50,7 +51,7 @@ fi
# set header for no preferences/token message # set header for no preferences/token message
[[ -e /tmp/no-token.nfo ]] && \ [[ -e /tmp/no-token.nfo ]] && \
rm /tmp/no-token.nfo rm /tmp/no-token.nfo
NOTOKEN_SET='/tmp/no-token.nfo' NOTOKEN_SET='/tmp/no-token.nfo'
cat > "${NOTOKEN_SET}" <<-EOFTOKEN cat > "${NOTOKEN_SET}" <<-EOFTOKEN
##################################################### #####################################################
@ -70,8 +71,8 @@ fi
# attempt to read plex token # attempt to read plex token
PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \ PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \
"/config/Library/Application Support/Plex Media Server/Preferences.xml" \ "/config/Library/Application Support/Plex Media Server/Preferences.xml" \
| sed "s/\".*//") | sed "s/\".*//")
# if plex token isn't found, exit out # if plex token isn't found, exit out
if [ -z "$PLEX_TOKEN" ]; then if [ -z "$PLEX_TOKEN" ]; then

Loading…
Cancel
Save