Skip to content
This repository has been archived by the owner on Jun 13, 2019. It is now read-only.

Commit

Permalink
install: Do post install task only on windows
Browse files Browse the repository at this point in the history
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 <philippe.coval@osg.samsung.com>

Closes gh-158
  • Loading branch information
rzr authored and Gabriel Schulhof committed Jan 6, 2018
1 parent 20a9079 commit a587c84
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions build-scripts/postinstall.js
Expand Up @@ -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 );
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit a587c84

Please sign in to comment.