node-red / linux-installers

Node-RED install scripts for various flavours of Linux
Apache License 2.0
94 stars 63 forks source link

added --nodered-user for setting user under sudo #22

Closed trentinc closed 2 years ago

trentinc commented 2 years ago

RE: Feature request

I've modified the installer script to allow for specifying the username to install as, useful when using escalated privileges an not ending up under /root

Tested on Raspberry Pi Zero W and Ubuntu server 20.04 (on vmware esxi) with the following:

  1. bash <(curl -sL https://raw.githubusercontent.com/trentinc/linux-installers/master/deb/update-nodejs-and-nodered)
  2. curl -sL https://raw.githubusercontent.com/trentinc/linux-installers/master/deb/update-nodejs-and-nodered | sudo bash -s -- --confirm-install --confirm-root --skip-pi
  3. curl -sL https://raw.githubusercontent.com/trentinc/linux-installers/master/deb/update-nodejs-and-nodered | sudo bash -s -- --confirm-install --confirm-root --skip-pi --nodered-user=pi

All 3 installs were successful on both devices. In 1 and 3 user was correctly set to 'pi', verified .node-red folder in /home/pi directory and correct contents inside the nodered.service file. In 2 install happened under /root as per normal

I did try the script on a VM running Raspberry Pi Desktop however I ran into some issues I think are unrelated to my modifications. I had not run an apt update and apt upgrade before running the script and apt was hanging on some changes. however after updating the install scripts fails after the install nodejs 14 step because it installs v10.24.0 and npm is missing

linux-foundation-easycla[bot] commented 2 years ago

CLA Signed

The committers are authorized under a signed CLA.

dceejay commented 2 years ago

Excellent - looks good to me. Many thanks.