sign safari appex after libs

This commit is contained in:
Kyle Spearrin 2019-09-30 15:41:16 -04:00
parent 53fe65ddbe
commit 427c9def58
1 changed files with 34 additions and 29 deletions

View File

@ -44,7 +44,7 @@ function pkgMas(cb) {
return del([paths.dist + 'mas/Bitwarden*.pkg']) return del([paths.dist + 'mas/Bitwarden*.pkg'])
.then(() => { .then(() => {
return signLibs(cb, 'mas'); return signMas(cb);
}).then(() => { }).then(() => {
const proc = child.spawn('productbuild', [ const proc = child.spawn('productbuild', [
'--component', '--component',
@ -68,6 +68,9 @@ function pkgMas(cb) {
}); });
} }
function signMas(cb) {
return signSafariExt(cb, 'mas');
}
function signMac(cb) { function signMac(cb) {
return signSafariExt(cb, 'mac'); return signSafariExt(cb, 'mac');
@ -81,36 +84,37 @@ function signSafariExt(cb, dir) {
const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib')) const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib'))
.map((p) => safariAppexFrameworkPath + p); .map((p) => safariAppexFrameworkPath + p);
const allItems = libs.concat([safariAppexPath]); const libPromises = [];
const promises = []; var args = dir === 'mas' ?
allItems.forEach((i) => { [
var args = dir === 'mas' ? '--verbose',
[ '--force',
'--verbose', '--sign',
'--force', '3rd Party Mac Developer Application: 8bit Solutions LLC',
'--sign', '--entitlements',
'3rd Party Mac Developer Application: 8bit Solutions LLC', safariEntitlementsPath
'--entitlements', ] :
safariEntitlementsPath, [
i '--verbose',
] : '--force',
[ '-o',
'--verbose', 'runtime',
'--force', '--sign',
'-o', 'Developer ID Application: 8bit Solutions LLC',
'runtime', '--entitlements',
'--sign', safariEntitlementsPath
'Developer ID Application: 8bit Solutions LLC', ];
'--entitlements', libs.forEach((i) => {
safariEntitlementsPath, const proc = child.spawn('codesign', args.concat([i]));
i
];
const proc = child.spawn('codesign', args);
stdOutProc(proc); stdOutProc(proc);
promises.push(new Promise((resolve) => proc.on('close', resolve))); libPromises.push(new Promise((resolve) => proc.on('close', resolve)));
promises.push(new Promise((resolve) => setTimeout(() => resolve(), 10000))); libPromises.push(new Promise((resolve) => setTimeout(() => resolve(), 10000)));
}); });
return Promise.all(promises).then(() => { return Promise.all(libPromises).then(() => {
const proc = child.spawn('codesign', args.concat([safariAppexPath]));
stdOutProc(proc);
return new Promise((resolve) => proc.on('close', resolve));
}).then(() => {
return cb; return cb;
}, () => { }, () => {
return cb; return cb;
@ -128,5 +132,6 @@ exports.webfonts = gulp.series(clean, webfonts);
exports['prebuild:renderer'] = gulp.parallel(webfonts, cleanupAotIssue); exports['prebuild:renderer'] = gulp.parallel(webfonts, cleanupAotIssue);
exports.fixSweetAlert = fixSweetAlert; exports.fixSweetAlert = fixSweetAlert;
exports.pkgMas = pkgMas; exports.pkgMas = pkgMas;
exports.signMas = signMas;
exports.signMac = signMac; exports.signMac = signMac;
exports.postinstall = fixSweetAlert; exports.postinstall = fixSweetAlert;