From 9e274ea59b50143f7fb1b40f0e2dd8b2f6795696 Mon Sep 17 00:00:00 2001 From: Nicola Peditto Date: Fri, 28 Jul 2017 12:48:15 +0200 Subject: [PATCH] RPC addresses updated in some modules. Installation procedures updated. Guide updated. NPM settings updated. --- docs/ubuntu1604.md | 4 +--- modules/gpio-manager/manage-pins.js | 10 +++++----- modules/plugins-manager/manage-plugins.js | 10 +++++----- modules/vnets-manager/manage-networks.js | 6 +++--- package.json | 4 ++-- scripts/postinst | 24 +++++++++++++++++++++++ 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/docs/ubuntu1604.md b/docs/ubuntu1604.md index f957f4b..156fcce 100644 --- a/docs/ubuntu1604.md +++ b/docs/ubuntu1604.md @@ -18,9 +18,7 @@ node -v npm install -g npm npm config set python `which python2.7` npm -v -``` -##### Configure npm NODE_PATH variable -``` + echo "NODE_PATH=/usr/lib/node_modules" | tee -a /etc/environment source /etc/environment > /dev/null echo $NODE_PATH diff --git a/modules/gpio-manager/manage-pins.js b/modules/gpio-manager/manage-pins.js index 63b04c5..cd41305 100644 --- a/modules/gpio-manager/manage-pins.js +++ b/modules/gpio-manager/manage-pins.js @@ -103,11 +103,11 @@ function setMode(args) { exports.exportPins = function (session) { //Register all the module functions as WAMP RPCs - session.register(boardCode + '.command.rpc.setmode', setMode); - session.register(boardCode + '.command.rpc.read.digital', readDigital); - session.register(boardCode + '.command.rpc.write.digital', writeDigital); - session.register(boardCode + '.command.rpc.read.analog', readAnalog); - session.register(boardCode + '.command.rpc.write.analog', writeAnalog); + session.register('s4t'+ boardCode + '.gpio.setmode', setMode); + session.register('s4t'+ boardCode + '.gpio.read.digital', readDigital); + session.register('s4t'+ boardCode + '.gpio.write.digital', writeDigital); + session.register('s4t'+ boardCode + '.gpio.read.analog', readAnalog); + session.register('s4t'+ boardCode + '.gpio.write.analog', writeAnalog); logger.info('[WAMP-EXPORTS] Pins exported to the cloud!'); diff --git a/modules/plugins-manager/manage-plugins.js b/modules/plugins-manager/manage-plugins.js index 6bf2259..3ea3ae4 100644 --- a/modules/plugins-manager/manage-plugins.js +++ b/modules/plugins-manager/manage-plugins.js @@ -1035,11 +1035,11 @@ exports.removePlugin = function(args){ exports.exportPluginCommands = function (session){ //Register all the module functions as WAMP RPCs - session.register(boardCode+'.command.rpc.plugin.run', exports.run); - session.register(boardCode+'.command.rpc.plugin.kill', exports.kill); - session.register(boardCode+'.command.rpc.injectplugin', exports.injectPlugin); - session.register(boardCode+'.command.rpc.plugin.call', exports.call); - session.register(boardCode+'.command.rpc.removeplugin', exports.removePlugin); + session.register('s4t'+ boardCode+'.plugin.run', exports.run); + session.register('s4t'+ boardCode+'.plugin.kill', exports.kill); + session.register('s4t'+ boardCode+'.plugin.inject', exports.injectPlugin); + session.register('s4t'+ boardCode+'.plugin.call', exports.call); + session.register('s4t'+ boardCode+'.plugin.remove', exports.removePlugin); logger.info('[WAMP-EXPORTS] Plugin commands exported to the cloud!'); diff --git a/modules/vnets-manager/manage-networks.js b/modules/vnets-manager/manage-networks.js index 17a7188..7a5e2c1 100644 --- a/modules/vnets-manager/manage-networks.js +++ b/modules/vnets-manager/manage-networks.js @@ -398,9 +398,9 @@ exports.exportNetworkCommands = function (session) { session_wamp = session; //Register all the module functions as WAMP RPCs - session.register(boardCode + '.command.rpc.network.setSocatOnBoard', exports.setSocatOnBoard); - session.register(boardCode + '.command.rpc.network.addToNetwork', exports.addToNetwork); - session.register(boardCode + '.command.rpc.network.removeFromNetwork', exports.removeFromNetwork); + session.register('s4t'+ boardCode + '.vnet.setSocatOnBoard', exports.setSocatOnBoard); + session.register('s4t'+ boardCode + '.vnet.addToNetwork', exports.addToNetwork); + session.register('s4t'+ boardCode + '.vnet.removeFromNetwork', exports.removeFromNetwork); logger.info('[WAMP-EXPORTS] Network commands exported to the cloud!'); diff --git a/package.json b/package.json index b755a0d..63954fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iotronic-lightning-rod", - "version": "1.0.4", + "version": "1.1.0", "description": "Implementation of the Lightning-rod, the Stack4Things node-side probe (this version works with the standalone version of IoTronic) http://stack4things.unime.it/", "main": "lightning-rod.js", "directories": { @@ -22,7 +22,7 @@ "requestify": ">=0.1.17", "is-running": ">=2.0.0", "connection-tester": ">=0.1.1", - "log4js": ">=0.6.37", + "log4js": "<=1.1.0", "q": ">=0.9.7", "fs-access": ">=1.0.1", "mknod": ">=1.1.0", diff --git a/scripts/postinst b/scripts/postinst index beb54e7..63ffc7e 100755 --- a/scripts/postinst +++ b/scripts/postinst @@ -30,6 +30,30 @@ fi echo "Configuring..." +# Set Environment variables +if grep -Fq "IOTRONIC_HOME" /etc/profile +then + # if found + echo "IOTRONIC_HOME env var already set." +else + # if not found + echo "Setting IOTRONIC_HOME env var." + echo "export IOTRONIC_HOME=/var/lib/iotronic" >> /etc/profile + source /etc/profile +fi + +if grep -Fq "LIGHTNINGROD_HOME" /etc/profile +then + # if found + echo "LIGHTNINGROD_HOME env var already set." +else + # if not found + echo "Setting LIGHTNINGROD_HOME env var." + echo "export LIGHTNINGROD_HOME=/usr/lib/node_modules/iotronic-lightning-rod" >> /etc/profile + source /etc/profile +fi + + echo "After the installation execute lr_configure.sh script in order to complete the Lightning-rod configuration!" echo "--> /usr/lib/node_modules/iotronic-lightning-rod/scripts/lr_configure.sh" chmod +x /usr/lib/node_modules/iotronic-lightning-rod/scripts/lr_configure.sh