From a587c84a95193de3cf1dee0b712cbe62785ec659 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Thu, 26 Oct 2017 11:14:21 +0200 Subject: [PATCH] install: Do post install task only on windows On my GNU/Linux system, I observed those log on npm install: NODE_ENV=production npm install > iotivity-node@1.3.0-3 postinstall /tmp/iotivity-node > node build-scripts/postinstall.js mv: no such file or directory: iotivity-node/build/Release/octbstack.dll mv: no such file or directory: iotivity-node/octbstack.dll It's not blocking, but can be missleading, when troubleshooting issues while trying iot-rest-api-server. Signed-off-by: Philippe Coval Closes gh-158 --- build-scripts/postinstall.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build-scripts/postinstall.js b/build-scripts/postinstall.js index 70ce906a..8d9f50c7 100644 --- a/build-scripts/postinstall.js +++ b/build-scripts/postinstall.js @@ -15,6 +15,7 @@ var path = require( "path" ); var fs = require( "fs" ); var shelljs = require( "shelljs" ); +var os = require( "os" ); var repoPaths = require( "./helpers/repo-paths" ); var addonAbsoluteName = require( "bindings" )( { bindings: "iotivity", path: true } ); var addonAbsolutePath = path.dirname( addonAbsoluteName ); @@ -44,11 +45,15 @@ if ( !isDependency ) { // Purge intermediate build files but leave the addon where it is shelljs.mv( addonAbsoluteName, repoPaths.root ); -shelljs.mv( path.join( addonAbsolutePath, "octbstack.dll" ), repoPaths.root ); +if ( os.platform() === "win32" ) { + shelljs.mv( path.join( addonAbsolutePath, "octbstack.dll" ), repoPaths.root ); +} shelljs.rm( "-rf", path.join( repoPaths.root, "build" ) ); shelljs.mkdir( "-p", addonAbsolutePath ); shelljs.mv( path.join( repoPaths.root, addonName ), addonAbsolutePath ); -shelljs.mv( path.join( repoPaths.root, "octbstack.dll" ), addonAbsolutePath ); +if ( os.platform() === "win32" ) { + shelljs.mv( path.join( repoPaths.root, "octbstack.dll" ), addonAbsolutePath ); +} // Purge any and all files not needed after building shelljs.rm( "-rf",