From 1b971e9da59bead54eac3f7776dbe73fd99a416e Mon Sep 17 00:00:00 2001 From: Alex Malinovich Date: Tue, 20 Dec 2016 16:35:22 -0800 Subject: [PATCH] Exit with code 6 if an update is available/installed --- plexupdate.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plexupdate.sh b/plexupdate.sh index 6895e2d..4f99d65 100755 --- a/plexupdate.sh +++ b/plexupdate.sh @@ -607,8 +607,7 @@ if [ "${SKIP_DOWNLOAD}" = "no" ]; then info "File downloaded" fi -sha1sum --status -c "${FILE_SHA}" -if [ $? -ne 0 ]; then +if ! sha1sum --status -c "${FILE_SHA}"; then error "Downloaded file corrupt. Try again." exit 4 fi @@ -628,6 +627,11 @@ if [ "${AUTOINSTALL}" = "yes" ]; then # no elif since DISTRO_INSTALL will produce error output for us ${DISTRO_INSTALL} "${DOWNLOADDIR}/${FILENAME}" + RET=$? + if [ $RET -ne 0 ]; then + error "Error reported while installing ${FILENAME}." + exit $RET + fi fi if [ "${AUTODELETE}" = "yes" ]; then @@ -656,4 +660,5 @@ if [ "${AUTOSTART}" = "yes" ]; then fi fi -exit 0 +# If we've made it this far and haven't exited it means an update was downloaded and/or installed +exit 6