Add --run-after and RUNAFTER parameter to run after successful install.

This commit is contained in:
Nicholas Sperling 2019-04-09 09:56:52 -04:00
commit ec8137e42d

View file

@ -96,6 +96,7 @@ usage() {
echo " --port <Plex server port> Port for Plex Server. Used with --server" echo " --port <Plex server port> Port for Plex Server. Used with --server"
echo " --server <Plex server address> Address of Plex Server" echo " --server <Plex server address> Address of Plex Server"
echo " --token Manually specify the token to use to download Plex Pass releases" echo " --token Manually specify the token to use to download Plex Pass releases"
echo " --run-after Program to run after successful install."
echo "" echo ""
exit 0 exit 0
} }
@ -174,6 +175,7 @@ do
(--server) shift; PLEXSERVER=$(trimQuotes ${1});; (--server) shift; PLEXSERVER=$(trimQuotes ${1});;
(--port) shift; PLEXPORT=$(trimQuotes ${1});; (--port) shift; PLEXPORT=$(trimQuotes ${1});;
(--token) shift; TOKEN=$(trimQuotes ${1});; (--token) shift; TOKEN=$(trimQuotes ${1});;
(--run-after) shift; RUNAFTER=$(trimQuotes ${1});;
(--help) usage;; (--help) usage;;
(--notify-success) NOTIFY=yes;; (--notify-success) NOTIFY=yes;;
@ -500,9 +502,15 @@ if [ "${AUTOINSTALL}" = "yes" ]; then
RET=$? RET=$?
if [ ${RET} -ne 0 ]; then if [ ${RET} -ne 0 ]; then
# Clarify why this failed, so user won't be left in the dark # Clarify why this failed, so user won't be left in the dark
error "Failed to install update. Command '${DISTRO_INSTALL} "${DOWNLOADDIR}/${FILENAME}"' returned error code ${RET}" error "Failed to install update. Command '${DISTRO_INSTALL} \"${DOWNLOADDIR}/${FILENAME}\"' returned error code ${RET}"
exit ${RET} exit ${RET}
fi fi
if [ ! -z "${RUNAFTER}" ]; then
# RUNAFTER command has been set. Pass version number as a parameter.
verboseOutput "Successfully installed update. Running '${RUNAFTER} \"${FILE_VERSION}\"'"
${RUNAFTER} "${FILE_VERSION}"
fi
fi fi
if [ "${AUTODELETE}" = "yes" ]; then if [ "${AUTODELETE}" = "yes" ]; then