Skip to content

Commit 7d3dbd4

Browse files
committed
install lgpio for recent pi gpio compatability
and always run init if no settings
1 parent 110c590 commit 7d3dbd4

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

deb/update-nodejs-and-nodered

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ case $yn in
306306
# echo " "
307307
# echo " You can use the old v1 branch by specifying --nodered-version=1.*"
308308
echo " "
309-
echo " You can force an install of node 16, 18 or 20 by adding --node16, --node18 or --node20 to the end of the command line above."
309+
echo " You can force an install of node 16, 18 or 20 by adding --node18 or --node20 to the end of the command line above."
310310
echo " However doing so may break some nodes that may need re-installing manually."
311311
echo " Generally it is recommended to update all nodes to their latest versions before upgrading."
312312
echo " "
@@ -319,7 +319,7 @@ case $yn in
319319
fi
320320
echo " Please backup your installation and flows before upgrading."
321321
echo " "
322-
if ! $SUDO grep -q BCM2 /proc/cpuinfo; then
322+
if ! $SUDO grep -q Raspberry /proc/cpuinfo; then
323323
echo " Note: not all embedded hardware can be updated via this method - please check before proceeding."
324324
echo " "
325325
fi
@@ -374,7 +374,7 @@ case $yn in
374374
echo -ne " Leave existing Node.js :"
375375
elif [[ "$NODE_VERSION" == "" && "$nv" -ne 0 ]]; then
376376
CHAR="-"
377-
echo -ne " Node option not specified : --node16, --node18 or --node20\n"
377+
echo -ne " Node option not specified : --node18 or --node20\n"
378378
echo -ne " Leave existing Node.js :"
379379
else
380380
if [[ "$NODE_VERSION" == "12" ]]; then
@@ -689,10 +689,12 @@ case $yn in
689689

690690
# on Pi, add launcher to top bar, add cpu temp example, make sure ping works
691691
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
692-
if $SUDO grep -q BCM2 /proc/cpuinfo; then
692+
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 install -y python3-rpi.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
696698
fi
697699
$SUDO setcap cap_net_raw=ep /bin/ping 2>&1 | $SUDO tee -a /var/log/nodered-install.log >>/dev/null
698700

@@ -784,19 +786,21 @@ case $yn in
784786
echo " "
785787
if [ ! -f ~/.node-red/settings.js ]; then
786788
initset="${INITSET}"
787-
[ ! "${INITSET}" ] && read -t 60 -p " Would you like to customise the settings now (y/N) ? " initset
789+
# [ ! "${INITSET}" ] && read -t 60 -p " Would you like to customise the settings now (y/N) ? " initset
788790
case $initset in
789791
[Yy]* )
790792
node-red admin init
791793
$SUDO chown 0:0 ~/.node-red/settings.js
792794
;;
793-
"n")
795+
[Nn]* )
794796
echo "Settings not initialized."
795797
exit 0
796798
;;
797799
* )
798-
echo " "
799-
exit 1
800+
# echo " "
801+
# exit 1
802+
node-red admin init
803+
$SUDO chown 0:0 ~/.node-red/settings.js
800804
;;
801805
esac
802806
fi

0 commit comments

Comments
 (0)