Skip to content

Commit

Permalink
Updated postInstall script and readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
codearoni committed Mar 26, 2020
1 parent 6cf0666 commit 38f9611
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,27 @@ npm install zxp-provider

# Usage

zxp-provider has a simple interface for calling ZXPSignCmd. Most users will want to use the 'bin' property, which will provide the zxp binary appropriate to your OS.
zxp-provider has a simple interface for calling ZXPSignCmd. Most users will want to call zxp-provider with no arguments. This will return the latest version of ZXPSignCmd, for your current running operating system.

```javascript
var zxp = require('zxp-provider').bin;
const zxpProvider = require('zxp-provider');
const zxp = zxpProvider(); // returns the lastest version for the current operation system
```

If you would like to manually choose the executable, zxp-provider provides an interface for that as well.
If you would like to manually choose the version of ZXPSignCmd, an interface is provided for that. Please see CEP-Resources if you're unsure what versions are available. If you would like, zxp-provider also contains an Array of supported versions.

```javascript
var zxpWin32 = require('zxp-provider').win32;
const chosenVersion = zxpProvider.supportedVersions[0]; // select the oldest version of ZXPSignCmd
const zxp = zxpProvider({ version: chosenVersion });
```

var zxpWin64 = require('zxp-provider').win64;
If you would like to manually select the os, you can do that as well. zxp-provider exposes an object containing all of the supported versions.

var zxpOsx = require('zxp-provider').osx;
```javascript
const win64 = zxpProvider.supportedPlatforms.win64; // manually select windows 64 bit
const zxp = zxpProvider({ os: win64 })
```

# Notes

zxp-provider v1.0.x - ZxpSignCmd v3.0.30

zxp-provider v1.1.x - ZxpSignCmd v4.0.7

[CEP-Resources](https://github.com/Adobe-CEP/CEP-Resources)
35 changes: 25 additions & 10 deletions postInstall.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
'use strict';

const util = require('util');
const fs = require('fs');
const path = require('path');
const os = require('os');
const readdir = util.promisify(fs.readdir);
const chmod = util.promisify(fs.chmod);

if (os.type() === 'Darwin') {
console.log('Updating permissions for /bin/osx...');
fs.chmod(path.resolve('./bin/osx/ZXPSignCmd'), '755', function (err) {
if (err) {
throw err;
} else {
console.log('Permissions for /bin/osx set to 755.');
}
});
}
const ZXP_SIGN_CMD = 'ZXPSignCmd';
const BIN_DIR = path.resolve('./bin');
const PERM_CODE = '755';

const chmodBinary = async (version) => {
const zxpPath = path.join(BIN_DIR, version, 'osx', ZXP_SIGN_CMD);
await chmod(zxpPath, PERM_CODE);
console.log(ZXP_SIGN_CMD + ' perms set to ' + PERM_CODE + ' at: ' + zxpPath);
};

(async () => {
if (os.type() === 'Darwin') {
console.log('Updating permissions for osx binaries.');
const versionDirectories = await readdir(BIN_DIR);
const chmodSet = [];
versionDirectories.forEach((version) => {
chmodSet.push(chmodBinary(version));
});

await Promise.all(chmodSet);
}
})();

0 comments on commit 38f9611

Please sign in to comment.