@@ -593,7 +593,6 @@ public static void addNewKeychain(Map<String, ? super Object> params)
593
593
Log .error (I18N .getString ("message.keychain.error" ));
594
594
return ;
595
595
}
596
-
597
596
boolean contains = keychainList .stream ().anyMatch (
598
597
str -> str .trim ().equals ("\" " +keyChainPath .trim ()+"\" " ));
599
598
if (contains ) {
@@ -608,7 +607,9 @@ public static void addNewKeychain(Map<String, ? super Object> params)
608
607
if (path .startsWith ("\" " ) && path .endsWith ("\" " )) {
609
608
path = path .substring (1 , path .length ()-1 );
610
609
}
611
- keyChains .add (path );
610
+ if (!keyChains .contains (path )) {
611
+ keyChains .add (path );
612
+ }
612
613
});
613
614
614
615
List <String > args = new ArrayList <>();
@@ -682,27 +683,23 @@ static void signAppBundle(
682
683
Log .verbose (MessageFormat .format (I18N .getString (
683
684
"message.ignoring.symlink" ), p .toString ()));
684
685
} else {
685
- List <String > args ;
686
- // runtime and Framework files will be signed below
687
- // but they need to be unsigned first here
688
- if ((p .toString ().contains ("/Contents/runtime" )) ||
689
- (p .toString ().contains ("/Contents/Frameworks" ))) {
690
-
691
- args = new ArrayList <>();
692
- args .addAll (Arrays .asList ("/usr/bin/codesign" ,
693
- "--remove-signature" , p .toString ()));
694
- try {
695
- Set <PosixFilePermission > oldPermissions =
696
- Files .getPosixFilePermissions (p );
697
- p .toFile ().setWritable (true , true );
698
- ProcessBuilder pb = new ProcessBuilder (args );
699
- IOUtils .exec (pb );
700
- Files .setPosixFilePermissions (p ,oldPermissions );
701
- } catch (IOException ioe ) {
702
- Log .verbose (ioe );
703
- toThrow .set (ioe );
704
- return ;
705
- }
686
+ // unsign everything before signing
687
+ List <String > args = new ArrayList <>();
688
+ args .addAll (Arrays .asList ("/usr/bin/codesign" ,
689
+ "--remove-signature" , p .toString ()));
690
+ try {
691
+ Set <PosixFilePermission > oldPermissions =
692
+ Files .getPosixFilePermissions (p );
693
+ p .toFile ().setWritable (true , true );
694
+ ProcessBuilder pb = new ProcessBuilder (args );
695
+ // run quietly
696
+ IOUtils .exec (pb , false , null , false ,
697
+ Executor .INFINITE_TIMEOUT , true );
698
+ Files .setPosixFilePermissions (p ,oldPermissions );
699
+ } catch (IOException ioe ) {
700
+ Log .verbose (ioe );
701
+ toThrow .set (ioe );
702
+ return ;
706
703
}
707
704
args = new ArrayList <>();
708
705
args .addAll (Arrays .asList ("/usr/bin/codesign" ,
@@ -727,7 +724,9 @@ static void signAppBundle(
727
724
Files .getPosixFilePermissions (p );
728
725
p .toFile ().setWritable (true , true );
729
726
ProcessBuilder pb = new ProcessBuilder (args );
730
- IOUtils .exec (pb );
727
+ // run quietly
728
+ IOUtils .exec (pb , false , null , false ,
729
+ Executor .INFINITE_TIMEOUT , true );
731
730
Files .setPosixFilePermissions (p , oldPermissions );
732
731
} catch (IOException ioe ) {
733
732
toThrow .set (ioe );
0 commit comments