From 2a9b48b2d5fef22d553ae0a65d4e57f98ad9be09 Mon Sep 17 00:00:00 2001 From: tteckster Date: Thu, 12 May 2022 17:21:31 -0400 Subject: [PATCH] Update zwavejs2mqtt-update.sh --- misc/zwavejs2mqtt-update.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/misc/zwavejs2mqtt-update.sh b/misc/zwavejs2mqtt-update.sh index f5654ba1..f72db32a 100644 --- a/misc/zwavejs2mqtt-update.sh +++ b/misc/zwavejs2mqtt-update.sh @@ -5,6 +5,22 @@ BL=`echo "\033[36m"` CM='\xE2\x9C\x94\033' GN=`echo "\033[1;92m"` CL=`echo "\033[m"` +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail +shopt -s expand_aliases +alias die='EXIT=$? LINE=$LINENO error_exit' +trap die ERR + +function error_exit() { + trap - ERR + local reason="Unknown failure occured." + local msg="${1:-$reason}" + local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE" + echo -e "$flag $msg" 1>&2 + exit $EXIT +} echo -en "${GN} Updating Zwavejs2MQTT... " systemctl stop zwavejs2mqtt.service