diff --git a/index.js b/index.js index 2c1299e..c1185ce 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ var ChildProcess = require('child_process') var fs = require('fs') var path = require('path') +var os = require('os') exports.sign = function (options, callback) { var signOptions = Object.assign({}, options) @@ -123,7 +124,7 @@ function spawnSign (options, outputPath, callback) { spawnOptions.stdio = ['ignore', 'ignore', 'pipe'] } - console.log("spawning " + getSigncodePath(options) + " " + args.join(' ')); + // console.log("spawning " + getSigncodePath(options) + " " + args.join(' ')); var signcode = ChildProcess.spawn(getSigncodePath(options), args, spawnOptions) var stderr = '' @@ -208,12 +209,16 @@ function getOutputPath (inputPath, hash) { } function getSigncodePath (options) { - if (options.signcodePath) { - return options.signcodePath; + var result = options.signcodePath || process.env.SIGNTOOL_PATH + if (result) { + return result + } + if (process.env.USE_SYSTEM_SIGNCODE || process.platform === 'linux') { + return "osslsigncode" } if (process.platform === 'win32') { - return path.join(__dirname, 'vendor', 'signtool.exe') + return path.join(__dirname, 'vendor', 'windows-' + (os.release().startsWith('6.') ? '6' : '10'), 'signtool.exe') } else { return path.join(__dirname, 'vendor', process.platform, 'osslsigncode') } diff --git a/package.json b/package.json index 1e3f439..a46d0f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "signcode-tf", - "version": "0.6.3", + "version": "0.7.3", "description": "Sign Windows executables from a Mac", "repository": "https://github.com/kevinsawicki/signcode", "main": "index.js", diff --git a/vendor/signtool.exe b/vendor/windows-10/signtool.exe similarity index 100% rename from vendor/signtool.exe rename to vendor/windows-10/signtool.exe diff --git a/vendor/windows-6/signtool.exe b/vendor/windows-6/signtool.exe new file mode 100755 index 0000000..c618943 Binary files /dev/null and b/vendor/windows-6/signtool.exe differ