#test if plex is installed and try re-pulling latest if not
dpkg -s plexmediaserver > /dev/null 2>&1 || \
(echo "for some reason the update has failed and plex doesn't seem to be installed, retrying a known version" && curl -o /tmp/plexmediaserver.deb -L "${PLEX_INSTALL}" && dpkg -i /tmp/plexmediaserver.deb)
#recopy config file in case update overwrites our copy