22
33# copy config on first run, regardless of update status
44[[ ! -e /etc/default/plexmediaserver ]] && \
5- cp /defaults/plexmediaserver /etc/default/plexmediaserver
5+ cp /defaults/plexmediaserver /etc/default/plexmediaserver
66
77# test if plex is installed and try re-pulling latest if not
8- if dpkg -s plexmediaserver > /dev/null 2>&1 ; then
8+ if ( dpkg --get-selections plexmediaserver | grep -wq "install") ; then
99:
10- else echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script"
10+ else
11+ echo "for some reason plex doesn't appear to be installed, pulling a new copy and exiting out of update script"
1112curl -o /tmp/plexmediaserver.deb -L \
12- "${PLEX_INSTALL}" && \
13+ "${PLEX_INSTALL}" && \
1314dpkg -i --force-confold /tmp/plexmediaserver.deb
1415rm -f /tmp/plexmediaserver.deb
1516exit 0
1617fi
1718
1819# set no update message
1920[[ -e /tmp/no-version.nfo ]] && \
20- rm /tmp/no-version.nfo
21+ rm /tmp/no-version.nfo
2122NOVERSION_SET='/tmp/no-version.nfo'
2223cat > "${NOVERSION_SET}" <<-EOFVERSION
2324#######################################################
@@ -30,7 +31,7 @@ EOFVERSION
3031
3132# set update failed message
3233[[ -e /tmp/update_fail.nfo ]] && \
33- rm /tmp/update_fail.nfo
34+ rm /tmp/update_fail.nfo
3435UPGRADE_FAIL='/tmp/update_fail.nfo'
3536cat > "${UPGRADE_FAIL}" <<-EOFFAIL
3637########################################################
5051
5152# set header for no preferences/token message
5253[[ -e /tmp/no-token.nfo ]] && \
53- rm /tmp/no-token.nfo
54+ rm /tmp/no-token.nfo
5455NOTOKEN_SET='/tmp/no-token.nfo'
5556cat > "${NOTOKEN_SET}" <<-EOFTOKEN
5657#####################################################
7071
7172# attempt to read plex token
7273PLEX_TOKEN=$( sed -n 's/.*PlexOnlineToken="//p' \
73- "/config/Library/Application Support/Plex Media Server/Preferences.xml" \
74- | sed "s/\".*//")
74+ "/config/Library/Application Support/Plex Media Server/Preferences.xml" \
75+ | sed "s/\".*//")
7576
7677# if plex token isn't found, exit out
7778if [ -z "$PLEX_TOKEN" ]; then
0 commit comments