Update node-red-install.sh

This commit is contained in:
tteckster 2022-10-23 14:45:07 -04:00 committed by GitHub
parent f99b7649b5
commit bfb6c36b33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 23 deletions

View File

@ -11,22 +11,6 @@ CM="${GN}✓${CL}"
CROSS="${RD}${CL}" CROSS="${RD}${CL}"
BFR="\\r\\033[K" BFR="\\r\\033[K"
HOLD="-" 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 occurred."
local msg="${1:-$reason}"
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
echo -e "$flag $msg" 1>&2
exit $EXIT
}
function msg_info() { function msg_info() {
local msg="$1" local msg="$1"
@ -59,13 +43,9 @@ done
msg_ok "Set up Container OS" msg_ok "Set up Container OS"
msg_ok "Network Connected: ${BL}$(hostname -I)" msg_ok "Network Connected: ${BL}$(hostname -I)"
set +e
alias die=''
if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi; if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi;
RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs) RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs)
if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi; if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi;
alias die='EXIT=$? LINE=$LINENO error_exit'
set -e
msg_info "Updating Container OS" msg_info "Updating Container OS"
apt-get update &>/dev/null apt-get update &>/dev/null
@ -75,12 +55,10 @@ msg_ok "Updated Container OS"
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
apt-get install -y curl &>/dev/null apt-get install -y curl &>/dev/null
apt-get install -y sudo &>/dev/null apt-get install -y sudo &>/dev/null
apt-get install -y git &>/dev/null
apt-get install -y build-essential &>/dev/null
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Node-Red" msg_info "Installing Node-Red"
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --confirm-root --confirm-install --skip-pi --node18 --no-init &>/dev/null bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --confirm-root --confirm-install --skip-pi --no-init &>/dev/null
systemctl enable --now nodered.service &>/dev/null systemctl enable --now nodered.service &>/dev/null
msg_ok "Installed Node-Red" msg_ok "Installed Node-Red"