11#! /bin/bash
22#
3- # Copyright 2016,2023 JS Foundation and other contributors, https://js.foundation/
3+ # Copyright 2016,2024 JS Foundation and other contributors, https://js.foundation/
44# Copyright 2015,2016 IBM Corp.
55#
66# Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,7 +26,7 @@ tgta16=16.20.2 # need armv6l latest from https://unofficial-builds.nodejs.org/
2626tgtl16=16.20.2 # need x86 latest from https://unofficial-builds.nodejs.org/download/release/
2727tgta18=18.19.0 # need armv6l latest from https://unofficial-builds.nodejs.org/download/release/
2828tgtl18=18.4.0 # need x86 latest from https://unofficial-builds.nodejs.org/download/release/
29- tgta20=20.10 .0 # need armv6l latest from https://unofficial-builds.nodejs.org/download/release/
29+ tgta20=20.11 .0 # need armv6l latest from https://unofficial-builds.nodejs.org/download/release/
3030# tgtl20=None # need x86 latest from https://unofficial-builds.nodejs.org/download/release/
3131
3232usage () {
@@ -692,9 +692,16 @@ case $yn in
692692 if $SUDO grep -q Raspberry /proc/cpuinfo; then
693693 # $SUDO setcap cap_net_raw+eip $(eval readlink -f `which node`) 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
694694 $SUDO adduser $NODERED_USER gpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
695- $SUDO apt purge -y python3-rpi.gpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
696- $SUDO apt install -y python3-pip 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
697- $SUDO pip3 install --break-system-packages rpi-lgpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
695+ ISS=$( cat /etc/issue | cut -d ' /' -f 2 | cut -d ' ' -f 2)
696+ if (( $ISS > 11 )) ; then
697+ echo " Replace old rpi.gpio with lgpio" | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
698+ $SUDO apt purge -y python3-rpi.gpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
699+ $SUDO apt install -y python3-pip 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
700+ $SUDO pip3 install --break-system-packages rpi-lgpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
701+ else
702+ echo " Leaving old rpi.gpio" | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
703+ $SUDO apt install -y python3-rpi.gpio 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
704+ fi
698705 fi
699706 $SUDO setcap cap_net_raw=ep /bin/ping 2>&1 | $SUDO tee -a /var/log/nodered-install.log >> /dev/null
700707
@@ -789,6 +796,7 @@ case $yn in
789796 # [ ! "${INITSET}" ] && read -t 60 -p " Would you like to customise the settings now (y/N) ? " initset
790797 case $initset in
791798 [Yy]* )
799+ export HOSTIP=` hostname -I | cut -d ' ' -f 1`
792800 node-red admin init
793801 $SUDO chown 0:0 ~ /.node-red/settings.js
794802 ;;
0 commit comments