#!/usr/bin/with-contenv bash # If docker manages versioning exit if [ "${VERSION}" ] && [ "${VERSION}" == 'docker' ]; then echo "Docker is used for versioning skip update check" exit 0 fi # test if plex is installed and try re-pulling latest if not 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" curl -o /tmp/plexmediaserver.deb -L \ "${PLEX_DOWNLOAD}/${REMOTE_VERSION}/debian/plexmediaserver_${REMOTE_VERSION}_${PLEX_ARCH}.deb" && \ dpkg -i --force-confold /tmp/plexmediaserver.deb rm -f /tmp/plexmediaserver.deb exit 0 fi # set no update message [[ -e /tmp/no-version.nfo ]] && \ rm /tmp/no-version.nfo NOVERSION_SET='/tmp/no-version.nfo' cat > "${NOVERSION_SET}" <<-EOFVERSION ####################################################### # Update routine will not run because you havent set # # the VERSION variable or you opted out of updates. # # For more information checkout :- # # https://github.com/linuxserver/docker-plex # ####################################################### EOFVERSION # set update failed message [[ -e /tmp/update_fail.nfo ]] && \ rm /tmp/update_fail.nfo UPGRADE_FAIL='/tmp/update_fail.nfo' cat > "${UPGRADE_FAIL}" <<-EOFFAIL ######################################################## # Upgrade attempt failed, this could be because either # # plex update site is down, local network issues, or # # you were trying to get a version that simply doesn't # # exist, check over the VERSION variable thoroughly & # # correct it or try again later. # ######################################################## EOFFAIL # test for no version set or opt out for autoupdates if [[ -z "$VERSION" ]] || [[ "$VERSION" == "0" ]] || [[ -n "$ADVANCED_DISABLEUPDATES" ]]; then printf '\n\n\n%s\n\n\n' "$( "${NOTOKEN_SET}" <<-EOFTOKEN ##################################################### # Login via the webui at http://:32400/web # # and restart the container, because there was no # EOFTOKEN # if preferences files doesn't exist, exit out if [ ! -e "/config/Library/Application Support/Plex Media Server/Preferences.xml" ]; then cat >> "${NOTOKEN_SET}" <<-EOFTOKEN # preference file found, possibly first startup. # ##################################################### EOFTOKEN printf '\n\n\n%s\n\n\n' "$(> "${NOTOKEN_SET}" <<-EOFTOKEN # plex token found in the preference file # ##################################################### EOFTOKEN printf '\n\n\n%s\n\n\n' "$(