Fix SensorTag node on Windows (#246)

Fix windows install 
(or rather - only run the postinstall if on Linux)
Thanks @hardillb
This commit is contained in:
Ben Hardill 2016-11-02 09:55:06 +00:00 committed by Dave Conway-Jones
parent 3e3b9aa706
commit d9c551c026
3 changed files with 22 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{
"name": "node-red-node-sensortag",
"description": "A Node-RED node to read data from a TI SensorTag",
"version": "0.0.16",
"version": "0.0.17",
"keywords": [
"node-red",
"sensortag",
@ -12,7 +12,7 @@
"sensortag": "~1.2.0"
},
"scripts" : {
"postinstall" : "scripts/pibt.sh"
"postinstall" : "node scripts/checkplatform.js pibt.sh"
},
"license": "Apache-2.0",
"repository": {

View File

@ -0,0 +1,17 @@
var spawn = require('child_process').spawn;
if (process.argv.length === 3) {
var command = process.argv[2];
if (process.platform === 'linux') {
var dir = __dirname;
var script = spawn(dir + "/" + command);
script.on('close',function(code){
process.exit(code);
});
} else {
process.exit(0);
}
} else {
process.exit(0);
}

View File

@ -1,6 +1,4 @@
#!/bin/bash
if grep -q ARM /proc/cpuinfo
then
sudo apt-get install libbluetooth-dev libudev-dev pi-bluetooth
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
fi
#sudo apt-get install libbluetooth-dev libudev-dev pi-bluetooth
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)