mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Fixup sensehat to not use sudo if not needed
This commit is contained in:
parent
35cbcb3345
commit
010e8aa9b3
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pi-sense-hat",
|
"name" : "node-red-node-pi-sense-hat",
|
||||||
"version" : "0.0.17",
|
"version" : "0.0.18",
|
||||||
"description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT",
|
"description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT",
|
||||||
"repository" : {
|
"repository" : {
|
||||||
"type":"git",
|
"type":"git",
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
BASEDIR=$(dirname $0)
|
BASEDIR=$(dirname $0)
|
||||||
sudo python -u $BASEDIR/sensehat.py $@
|
|
||||||
|
ID=$(id -u)
|
||||||
|
|
||||||
|
# Avoid using sudo if we're already root
|
||||||
|
SUDO=sudo
|
||||||
|
if [ $ID -eq 0 ]
|
||||||
|
then
|
||||||
|
SUDO=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
$SUDO python -u $BASEDIR/sensehat.py $@
|
||||||
|
Loading…
x
Reference in New Issue
Block a user