File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -135,10 +135,25 @@ async function pseudoSign (entitlement, file) {
135135 } else {
136136 args . push ( '-S' ) ;
137137 }
138+ const identifier = await getIdentifier ( file ) ;
139+ if ( identifier !== undefined ) {
140+ args . push ( '-I' + identifier ) ;
141+ }
138142 args . push ( file ) ;
139143 return execProgram ( getTool ( 'ldid2' ) , args , null ) ;
140144}
141145
146+ async function getIdentifier ( file ) {
147+ const res = await execProgram ( getTool ( 'codesign' ) , [ '-dv' , file ] , null ) ;
148+ const lines = res . stderr . split ( '\n' ) ;
149+ for ( const line of lines ) {
150+ const splt = line . split ( 'Identifier=' ) ;
151+ if ( splt . length === 2 ) {
152+ return splt [ 1 ] ;
153+ }
154+ }
155+ }
156+
142157async function verifyCodesign ( file , keychain , cb ) {
143158 const args = [ '-v' , '--no-strict' ] ;
144159 if ( typeof keychain === 'string' ) {
You can’t perform that action at this time.
0 commit comments