From c13119da7b65a43180b83bbca44cab096aa06472 Mon Sep 17 00:00:00 2001 From: tteckster Date: Mon, 25 Apr 2022 14:07:12 -0400 Subject: [PATCH] Update pihole-install.sh --- setup/pihole-install.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/setup/pihole-install.sh b/setup/pihole-install.sh index 632a2662..c5b6fc89 100644 --- a/setup/pihole-install.sh +++ b/setup/pihole-install.sh @@ -11,6 +11,22 @@ CM="${GN}✓${CL}" CROSS="${RD}✗${CL}" BFR="\\r\\033[K" HOLD="-" +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 +} function msg_info() { local msg="$1" @@ -38,7 +54,7 @@ done msg_ok "Set up Container OS" msg_ok "Network Connected: ${BL}$(hostname -I)" -wget -q --tries=10 --timeout=5 --spider http://google.com +wget -q --tries=10 --timeout=5 --spider https://google.com if [[ $? -eq 0 ]]; then msg_ok "Internet Online" else