#!/usr/bin/with-contenv bash # shellcheck shell=bash # If docker manages versioning exit if [[ -n "${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 if [[ -e /tmp/no-version.nfo ]]; then rm /tmp/no-version.nfo fi NOVERSION_SET='/tmp/no-version.nfo' cat >"${NOVERSION_SET}" <<-EOFVERSION ####################################################### # Update routine will not run because you haven't 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 if [[ -e /tmp/update_fail.nfo ]]; then rm /tmp/update_fail.nfo fi 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 auto updates 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 PLEX_MEDIA_SERVER_PREFERENCES="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server/Preferences.xml" if [[ ! -e "${PLEX_MEDIA_SERVER_PREFERENCES}" ]]; 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' "$(