diff --git a/hardware/sensorTag/package.json b/hardware/sensorTag/package.json index cd21ff54..cdd7b132 100644 --- a/hardware/sensorTag/package.json +++ b/hardware/sensorTag/package.json @@ -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": { diff --git a/hardware/sensorTag/scripts/checkplatform.js b/hardware/sensorTag/scripts/checkplatform.js new file mode 100644 index 00000000..59b8cf1e --- /dev/null +++ b/hardware/sensorTag/scripts/checkplatform.js @@ -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); +} \ No newline at end of file diff --git a/hardware/sensorTag/scripts/pibt.sh b/hardware/sensorTag/scripts/pibt.sh index 9f78db66..d4acebbc 100755 --- a/hardware/sensorTag/scripts/pibt.sh +++ b/hardware/sensorTag/scripts/pibt.sh @@ -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`) +