From cfda65cade5c2b9c75ad8c018c72f194ad572afb Mon Sep 17 00:00:00 2001 From: tteckster Date: Tue, 26 Oct 2021 14:34:31 -0400 Subject: [PATCH] Update node-red_setup.sh --- node-red_setup.sh | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/node-red_setup.sh b/node-red_setup.sh index 0d693abf..0f314261 100644 --- a/node-red_setup.sh +++ b/node-red_setup.sh @@ -1,10 +1,9 @@ #!/usr/bin/env bash -# Setup script environment -set -o errexit #Exit immediately if a pipeline returns a non-zero status -set -o errtrace #Trap ERR from shell functions, command substitutions, and commands from subshell -set -o nounset #Treat unset variables as an error -set -o pipefail #Pipe will exit with last non-zero status if applicable +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 @@ -23,41 +22,38 @@ function msg() { echo -e "$TEXT" } -# Prepare container OS msg "Setting up container OS..." sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen locale-gen >/dev/null apt-get -y purge openssh-{client,server} >/dev/null apt-get autoremove >/dev/null -# Update container OS msg "Updating container OS..." apt update &>/dev/null apt-get -qqy upgrade &>/dev/null -# Install prerequisites msg "Installing prerequisites..." apt-get -qqy install \ curl \ sudo &>/dev/null -msg "Installing Node..." -sudo apt -y install nodejs npm &>/dev/null +msg "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 -msg "Installing PM2..." -npm install -g pm2 &>/dev/null +#msg "Installing Node..." +#sudo apt -y install nodejs npm &>/dev/null -# Install Node Red -msg "Installing Node-RED..." -npm install -g --unsafe-perm node-red &>/dev/null +#msg "Installing PM2..." +#npm install -g pm2 &>/dev/null -# Set up PM2 to manage startup of Node Red -msg "Setting up PM2..." -/usr/local/bin/pm2 start /usr/local/bin/node-red &>/dev/null -/usr/local/bin/pm2 save &>/dev/null -/usr/local/bin/pm2 startup &>/dev/null +#msg "Installing Node-RED..." +#npm install -g --unsafe-perm node-red &>/dev/null + +#msg "Setting up PM2..." +#/usr/local/bin/pm2 start /usr/local/bin/node-red &>/dev/null +#/usr/local/bin/pm2 save &>/dev/null +#/usr/local/bin/pm2 startup &>/dev/null -# Customize container msg "Customizing container..." rm /etc/motd # Remove message of the day after login rm /etc/update-motd.d/10-uname # Remove kernel information after login @@ -72,6 +68,5 @@ EOF systemctl daemon-reload systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') -# Cleanup container msg "Cleanup..." rm -rf /node-red_setup.sh /var/{cache,log}/* /var/lib/apt/lists/*