772 String signingIdentity, String identifierPrefix,
773 String entitlementsFile, String inheritedEntitlements)
774 throws IOException {
775 AtomicReference<IOException> toThrow = new AtomicReference<>();
776 String appExecutable = "/Contents/MacOS/" + APP_NAME.fetchFrom(params);
777 String keyChain = SIGNING_KEYCHAIN.fetchFrom(params);
778
779 // sign all dylibs and jars
780 Files.walk(appLocation)
781 // fix permissions
782 .peek(path -> {
783 try {
784 Set<PosixFilePermission> pfp =
785 Files.getPosixFilePermissions(path);
786 if (!pfp.contains(PosixFilePermission.OWNER_WRITE)) {
787 pfp = EnumSet.copyOf(pfp);
788 pfp.add(PosixFilePermission.OWNER_WRITE);
789 Files.setPosixFilePermissions(path, pfp);
790 }
791 } catch (IOException e) {
792 Log.debug(e);
793 }
794 })
795 .filter(p -> Files.isRegularFile(p) &&
796 !(p.toString().contains("/Contents/MacOS/libjli.dylib")
797 || p.toString().endsWith(appExecutable))
798 ).forEach(p -> {
799 //noinspection ThrowableResultOfMethodCallIgnored
800 if (toThrow.get() != null) return;
801
802 // If p is a symlink then skip the signing process.
803 if (Files.isSymbolicLink(p)) {
804 if (VERBOSE.fetchFrom(params)) {
805 Log.verbose(MessageFormat.format(I18N.getString(
806 "message.ignoring.symlink"), p.toString()));
807 }
808 }
809 else {
810 List<String> args = new ArrayList<>();
811 args.addAll(Arrays.asList("codesign",
812 "-s", signingIdentity, // sign with this key
|
772 String signingIdentity, String identifierPrefix,
773 String entitlementsFile, String inheritedEntitlements)
774 throws IOException {
775 AtomicReference<IOException> toThrow = new AtomicReference<>();
776 String appExecutable = "/Contents/MacOS/" + APP_NAME.fetchFrom(params);
777 String keyChain = SIGNING_KEYCHAIN.fetchFrom(params);
778
779 // sign all dylibs and jars
780 Files.walk(appLocation)
781 // fix permissions
782 .peek(path -> {
783 try {
784 Set<PosixFilePermission> pfp =
785 Files.getPosixFilePermissions(path);
786 if (!pfp.contains(PosixFilePermission.OWNER_WRITE)) {
787 pfp = EnumSet.copyOf(pfp);
788 pfp.add(PosixFilePermission.OWNER_WRITE);
789 Files.setPosixFilePermissions(path, pfp);
790 }
791 } catch (IOException e) {
792 Log.verbose(e);
793 }
794 })
795 .filter(p -> Files.isRegularFile(p) &&
796 !(p.toString().contains("/Contents/MacOS/libjli.dylib")
797 || p.toString().endsWith(appExecutable))
798 ).forEach(p -> {
799 //noinspection ThrowableResultOfMethodCallIgnored
800 if (toThrow.get() != null) return;
801
802 // If p is a symlink then skip the signing process.
803 if (Files.isSymbolicLink(p)) {
804 if (VERBOSE.fetchFrom(params)) {
805 Log.verbose(MessageFormat.format(I18N.getString(
806 "message.ignoring.symlink"), p.toString()));
807 }
808 }
809 else {
810 List<String> args = new ArrayList<>();
811 args.addAll(Arrays.asList("codesign",
812 "-s", signingIdentity, // sign with this key
|