-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated postInstall script and readme.
- Loading branch information
Showing
2 changed files
with
36 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
})(); |