Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set version
id: version
run: |
Expand All @@ -29,41 +29,41 @@ jobs:
else
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
fi

- name: Create release directory
run: mkdir -p release-assets

- name: Copy installer scripts
run: |
cp deb/update-nodejs-and-nodered release-assets/update-nodejs-and-nodered-deb
cp deb/install-update-nodered release-assets/install-update-nodered-deb
cp rpm/update-nodejs-and-nodered release-assets/update-nodejs-and-nodered-rpm
chmod +x release-assets/update-nodejs-and-nodered-*

- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: Node-RED Linux Installers ${{ steps.version.outputs.VERSION }}
body: |
Node-RED Linux installer scripts for various distributions.

## Installation

### Debian, Ubuntu, Raspberry Pi OS
```bash
bash <(curl -sL https://github.com/node-red/linux-installers/releases/download/${{ steps.version.outputs.VERSION }}/update-nodejs-and-nodered-deb)
bash <(curl -sL https://github.com/node-red/linux-installers/releases/download/${{ steps.version.outputs.VERSION }}/install-update-nodered-deb)
```

### Red Hat, Fedora, CentOS, Oracle Linux
```bash
bash <(curl -sL https://github.com/node-red/linux-installers/releases/download/${{ steps.version.outputs.VERSION }}/update-nodejs-and-nodered-rpm)
```

## Changes
- Updated installer scripts
- See commit history for detailed changes
files: |
release-assets/update-nodejs-and-nodered-deb
release-assets/install-update-nodered-deb
release-assets/update-nodejs-and-nodered-rpm
draft: false
prerelease: false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pibuild/dist/*
*.deb
*.rpm
*socket
*.bak
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ matrix:
- env: OS='centos:7' OSTYPE='rpm'
- env: OS='centos:latest' OSTYPE="rpm"
- env: OS='fedora:latest' OSTYPE="rpm"
- env: OS='ubuntu:16.04' OSTYPE="deb"
- env: OS='ubuntu:18.04' OSTYPE="deb"
- env: OS='ubuntu:20.04' OSTYPE="deb"
- env: OS='debian:stretch' OSTYPE="deb"
- env: OS='debian:buster' OSTYPE="deb"
- env: OS='ubuntu:22.04' OSTYPE="deb"
- env: OS='ubuntu:24.04' OSTYPE="deb"
- env: OS='debian:bullseye' OSTYPE="deb"
- env: OS='debian:bookworm' OSTYPE="deb"
- env: OS='debian:trixie' OSTYPE="deb"

before_install:
- docker pull $OS
Expand All @@ -20,5 +21,5 @@ script:
- if [ "$OSTYPE" = "rpm" ]; then
docker run -it $OS /bin/sh -c "curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/rpm/update-nodejs-and-nodered > nr.sh && printf '%s\n' Y N Y | bash nr.sh";
else
docker run -it $OS /bin/sh -c "apt-get update && apt-get -y install curl sudo lsb-release && curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered > nr.sh && printf '%s\n' Y Y Y | bash nr.sh";
docker run -it $OS /bin/sh -c "apt-get update && apt-get -y install curl sudo lsb-release && curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/install-update-nodered > nr.sh && printf '%s\n' Y Y Y | bash nr.sh";
fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Both of the following commands use sudo (root) access to install Node-RED global
The command line for installing on a Debian based OS is:

```
bash <(curl -sL https://github.com/node-red/linux-installers/releases/latest/download/update-nodejs-and-nodered-deb)
bash <(curl -sL https://github.com/node-red/linux-installers/releases/latest/download/install-update-nodered)
```

you should ensure you have the build tools installed if you are going to install extra nodes.
Expand Down
43 changes: 24 additions & 19 deletions deb/install-update-nodered
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Default Node.js major version to install if none is present or --nodeXX flag is used
NODE_VERSION=24
# Pinned Node.js v22 build for ARMv6 (Pi Zero/1) - no v24+ builds exist for this arch
tgta22=22.22.3 # armv6l latest from https://unofficial-builds.nodejs.org/download/release/
ARMV6="n"

Expand Down Expand Up @@ -75,6 +77,7 @@ Options:
--nodered-version if not set, the latest version is used - e.g. --nodered-version="5.0.0"
--node22 if set, forces install of latest major version of nodejs 22 LTS
--node24 if set, forces install of latest major version of nodejs 24 LTS
--node26 if set, forces install of latest major version of nodejs 26 LTS
if none set, install nodejs 24 LTS if no nodejs is installed
otherwise leave current nodejs install

Expand Down Expand Up @@ -266,7 +269,9 @@ else
fi
SUDOU="sudo -u $NODERED_USER"

if curl -I https://registry.npmjs.org/@node-red/util >/dev/null 2>&1; then
curl -I https://registry.npmjs.org/@node-red/util >/dev/null 2>&1
CURL_RC=$?
if [ $CURL_RC -eq 0 ]; then

echo " "
echo Node-RED update script for : $NODERED_USER@$(hostname)
Expand Down Expand Up @@ -350,7 +355,7 @@ if curl -I https://registry.npmjs.org/@node-red/util >/dev/null 2>&1; then
echo -ne ' Using NVM to manage Node.js + please run \033[0;36mnvm use lts\033[0m before running Node-RED\r\n'
echo -ne ' NOTE: Using nvm is NOT RECOMMENDED. Node-RED will NOT run as a service under nvm.\r\n'
export NVM_DIR="$NODERED_HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \."$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
echo "Using NVM !!! $(nvm current)" 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
nvm install $NODE_VERSION --no-progress --latest-npm >/dev/null 2>&1
nvm use $NODE_VERSION >/dev/null 2>&1
Expand All @@ -377,7 +382,7 @@ if curl -I https://registry.npmjs.org/@node-red/util >/dev/null 2>&1; then
# unpack it into the correct places
hd=$(head -c 6 "$NODERED_HOME/node.tgz")
if [ "$hd" == "<!DOCT" ] || [ "$hd" == "<html>" ]; then
CHAR="$CROSS File $f not downloaded";
CHAR="$CROSS node-v${tgta22}-linux-armv6l.tar.gz not downloaded";
else
if [[ -d /tmp/nodejs ]]; then
$SUDO rm -rf /tmp/nodejs
Expand Down Expand Up @@ -482,7 +487,7 @@ if curl -I https://registry.npmjs.org/@node-red/util >/dev/null 2>&1; then
echo "Now install Node-RED $NODERED_VERSION" | $SUDO tee -a /var/log/nodered-install.log >>/dev/null

NODERED_VERSION_SELECTION=""
if [ -z ${NODERED_VERSION} ]; then
if [ -z "${NODERED_VERSION}" ]; then
NODERED_VERSION_SELECTION="latest"
else
NODERED_VERSION_SELECTION=${NODERED_VERSION}
Expand Down Expand Up @@ -538,13 +543,13 @@ EOF
echo -ne "$CHAR\r"
fi
echo -ne "\n"
if [[ ! -z $EXTRANODES ]]; then
if [[ -n "$EXTRANODES" ]]; then
npm i --save --no-progress --no-update-notifier --no-audit --no-fund $EXTRANODES 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
fi

# If armv6 then remove the bcrypt binary to workaround illegal instruction error
if uname -m | grep -q armv6l ; then
$SUDO rm -rf /usr/lib/node_modules/node-red/node_modules/@node-rs | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
$SUDO rm -rf /usr/lib/node_modules/node-red/node_modules/@node-rs 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
fi

popd 2>&1 >>/dev/null
Expand Down Expand Up @@ -593,10 +598,10 @@ EOF
else mem="4096"
fi

$SUDO sed -i 's#=512#='$mem'#;' "${SYSTEMDFILE}.temp"
$SUDO sed -i 's#^User=.*#User='$NODERED_USER'#;s#^Group=.*#Group='$NODERED_GROUP'#;s#^WorkingDirectory=.*#WorkingDirectory='$NODERED_HOME'#;s#^EnvironmentFile=-.*#EnvironmentFile=-'$NODERED_HOME'/.node-red/environment#;' "${SYSTEMDFILE}.temp"
$SUDO sed -i "s#=512#=${mem}#;" "${SYSTEMDFILE}.temp"
$SUDO sed -i "s#^User=.*#User=${NODERED_USER}#;s#^Group=.*#Group=${NODERED_GROUP}#;s#^WorkingDirectory=.*#WorkingDirectory=${NODERED_HOME}#;s#^EnvironmentFile=-.*#EnvironmentFile=-${NODERED_HOME}/.node-red/environment#;" "${SYSTEMDFILE}.temp"

grep -sq XDG_RUNTIME_DIR "$NODERED_HOME/.node-red/environment" || echo XDG_RUNTIME_DIR=/run/user/$UID >> "$NODERED_HOME/.node-red/environment"
grep -sq XDG_RUNTIME_DIR "$NODERED_HOME/.node-red/environment" || echo XDG_RUNTIME_DIR=/run/user/$(id -u "$NODERED_USER") >> "$NODERED_HOME/.node-red/environment"

if test -f "$SYSTEMDFILE"; then
# there's already a systemd script - compare checksums to detect customisation
Expand All @@ -621,7 +626,7 @@ EOF
echo -ne " Add shortcut commands : Skipped - systemd not found\r\n"
echo -ne " Update systemd script : Skipped - systemd not found\r\n"
fi
$SUDO ln -s "$(which python3)" /usr/bin/python 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
$SUDO ln -sf "$(which python3)" /usr/bin/python 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null

CHAR=$TICK
# remove unneeded large sentiment library to save space and load time
Expand All @@ -644,14 +649,14 @@ EOF
echo "Now add launcher to top bar, add cpu temp example, make sure ping works" | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
if $SUDO grep -q Raspberry /proc/cpuinfo; then
$SUDO adduser "$NODERED_USER" gpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
FAM=$(cut -d ' ' -f 1 /etc/issue) # FIX: removed useless cat pipe
ISS=$(cut -d '/' -f 2 /etc/issue | cut -d ' ' -f 2) # FIX: removed useless cat pipe
FAM=$(cut -d ' ' -f 1 /etc/issue) # OS family name, e.g. "Raspbian" or "Debian"
ISS=$(cut -d '/' -f 2 /etc/issue | cut -d ' ' -f 2) # OS family name, e.g. "Raspbian" or "Debian"
if [[ "$FAM" == *"bian" ]]; then
if [ "$ISS" -gt 11 ] && [ "$DIETPI" != "y" ]; then
echo "Replace old rpi.gpio with lgpio" | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
$SUDO apt purge -y python3-rpi.gpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
$SUDO apt install -y python3-rpi-lgpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
if [[ ! -z $EXTRANODES ]]; then
if [[ -n "$EXTRANODES" ]]; then
echo "Installing extra Pi nodes: $EXTRANODES :" | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
echo -ne " Installing Extra Pi nodes "
npm i --save --no-progress --no-update-notifier --no-audit --no-fund $EXTRANODES 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
Expand All @@ -668,7 +673,7 @@ EOF

echo "Allow binding to low ports : $LOW_PORTS" | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
if [[ "$LOW_PORTS" == "y" ]] ; then
$SUDO setcap cap_net_bind_service=+ep "$(eval readlink -f "$(which node)")" 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null # FIX: quoted subshell
$SUDO setcap cap_net_bind_service=+ep "$(readlink -f "$(which node)")" 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
fi

echo -ne " All done.\r\n\r\n"
Expand Down Expand Up @@ -708,20 +713,20 @@ EOF
fi
if [ ! -f "$file" ]; then
echo " "
elif ! diff -q -w --suppress-common-lines /usr/lib/node_modules/node-red/settings.js "$file" &>/dev/null 2>&1 ; then
elif ! diff -q -w --suppress-common-lines /usr/lib/node_modules/node-red/settings.js "$file" &>/dev/null ; then
CURL_OUTPUT=$($SUDO curl -sfL -m 30 -o "/tmp/merge-settings.js" https://raw.githubusercontent.com/node-red/linux-installers/master/resources/merge-settings.js 2>&1)
CURL_EXIT=$?
echo "$CURL_OUTPUT" | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
if [ $CURL_EXIT -eq 0 ]; then
echo " "
echo "Just FYI : Your settings.js file is different from the latest defaults."
read -t 20 -p "Would you like me to backup your existing settings.js and try to merge it with the new version ? (y/N) ? " yn
read -t 30 -p "Would you like me to backup your existing settings.js and try to merge it with the new version ? (y/N) ? " yn
case $yn in
[Yy]* )
node /tmp/merge-settings.js --diff "$file" "/usr/lib/node_modules/node-red/settings.js"
;;
* )
echo "You may wish to run"
echo -ne "\r\n\nYou may wish to run"
echo " diff -y -w --suppress-common-lines /usr/lib/node_modules/node-red/settings.js $file"
echo "to compare them and see what the latest options are."
;;
Expand Down Expand Up @@ -770,7 +775,7 @@ EOF
initset="${INITSET}"
case $initset in
[Yy]* )
export HOSTIP=$(hostname -I | cut -d ' ' -f 1) # FIX: replaced backtick with $()
export HOSTIP=$(hostname -I | cut -d ' ' -f 1)
$SUDO chown -Rf "$NODERED_USER:$NODERED_GROUP" "$NODERED_HOME/.node-red" 2>&1 >>/dev/null
$SUDOU /usr/bin/node-red admin init
;;
Expand All @@ -797,7 +802,7 @@ else
echo "Sorry - cannot connect to internet - not going to touch anything."
echo "https://www.npmjs.com/package/node-red is not reachable."
echo "Please ensure you have a working internet connection."
echo "Return code from curl is "$?
echo "Return code from curl is $CURL_RC"
echo " "
exit 1
fi