1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

support signing app at end

This commit is contained in:
Kyle Spearrin 2019-09-30 22:34:20 -04:00
parent 427c9def58
commit c87499e406

View File

@ -69,18 +69,19 @@ function pkgMas(cb) {
} }
function signMas(cb) { function signMas(cb) {
return signSafariExt(cb, 'mas'); return signApp(cb, 'mas');
} }
function signMac(cb) { function signMac(cb) {
return signSafariExt(cb, 'mac'); return signApp(cb, 'mac');
} }
function signSafariExt(cb, dir) { function signApp(cb, dir) {
const appPath = paths.dist + dir + '/Bitwarden.app'; const appPath = paths.dist + dir + '/Bitwarden.app';
const safariAppexPath = appPath + '/Contents/PlugIns/safari.appex'; const safariAppexPath = appPath + '/Contents/PlugIns/safari.appex';
const safariAppexFrameworkPath = safariAppexPath + '/Contents/Frameworks/'; const safariAppexFrameworkPath = safariAppexPath + '/Contents/Frameworks/';
const safariEntitlementsPath = paths.resources + 'safari.entitlements'; const safariEntitlementsPath = paths.resources + 'safari.entitlements';
const appEntitlementsPath = paths.resources + 'entitlements.' + dir + '.plist';
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);
@ -91,8 +92,7 @@ function signSafariExt(cb, dir) {
'--force', '--force',
'--sign', '--sign',
'3rd Party Mac Developer Application: 8bit Solutions LLC', '3rd Party Mac Developer Application: 8bit Solutions LLC',
'--entitlements', '--entitlements'
safariEntitlementsPath
] : ] :
[ [
'--verbose', '--verbose',
@ -101,17 +101,20 @@ function signSafariExt(cb, dir) {
'runtime', 'runtime',
'--sign', '--sign',
'Developer ID Application: 8bit Solutions LLC', 'Developer ID Application: 8bit Solutions LLC',
'--entitlements', '--entitlements'
safariEntitlementsPath
]; ];
libs.forEach((i) => { libs.forEach((i) => {
const proc = child.spawn('codesign', args.concat([i])); const proc = child.spawn('codesign', args.concat([safariEntitlementsPath, i]));
stdOutProc(proc); stdOutProc(proc);
libPromises.push(new Promise((resolve) => proc.on('close', resolve))); libPromises.push(new Promise((resolve) => proc.on('close', resolve)));
libPromises.push(new Promise((resolve) => setTimeout(() => resolve(), 10000))); libPromises.push(new Promise((resolve) => setTimeout(() => resolve(), 10000)));
}); });
return Promise.all(libPromises).then(() => { return Promise.all(libPromises).then(() => {
const proc = child.spawn('codesign', args.concat([safariAppexPath])); const proc = child.spawn('codesign', args.concat([safariEntitlementsPath, safariAppexPath]));
stdOutProc(proc);
return new Promise((resolve) => proc.on('close', resolve));
}).then(() => {
const proc = child.spawn('codesign', args.concat([appEntitlementsPath, appPath]));
stdOutProc(proc); stdOutProc(proc);
return new Promise((resolve) => proc.on('close', resolve)); return new Promise((resolve) => proc.on('close', resolve));
}).then(() => { }).then(() => {