Skip activity check if TOKEN is unavailable. Fixes #198 (#199)

This commit is contained in:
Alex Malinovich 2017-09-18 14:26:12 -07:00 committed by Henric Andersson
commit ab7f4052b1

View file

@ -334,13 +334,16 @@ if [ "${CHECKUPDATE}" = "yes" -a "${AUTOUPDATE}" = "no" ]; then
popd > /dev/null
fi
if [ "${PUBLIC}" = "no" -a -z "$TOKEN" ]; then
TO_SOURCE="$(dirname "$0")/extras/get-plex-token"
[ -f "$TO_SOURCE" ] && source $TO_SOURCE
if ! getPlexToken; then
if [ "${PUBLIC}" = "no" -o -n "${PLEXSERVER}" ] && ! getPlexToken; then
if [ "${PUBLIC}" = "no" ]; then
error "Unable to get Plex token, falling back to public release"
PUBLIC="yes"
fi
if [ -n "${PLEXSERVER}" ]; then
error "Unable to get Plex token, server activity check will be skipped"
PLEXSERVER=
fi
fi
if [ "$PUBLIC" != "no" ]; then
@ -486,9 +489,9 @@ if ! sha1sum --status -c "${FILE_SHA}"; then
exit 4
fi
if [ ! -z "${PLEXSERVER}" -a "${AUTOINSTALL}" = "yes" ]; then
if [ -n "${PLEXSERVER}" -a "${AUTOINSTALL}" = "yes" ]; then
# Check if server is in-use before continuing (thanks @AltonV, @hakong and @sufr3ak)...
if running ${PLEXSERVER} ${TOKEN} ${PLEXPORT}; then
if running "${PLEXSERVER}" "${TOKEN}" "${PLEXPORT}"; then
error "Server ${PLEXSERVER} is currently being used by one or more users, skipping installation. Please run again later"
exit 6
fi