Skip to content

Commit 22070e7

Browse files
committed
Added entitlements file for codesigning.
1 parent 3a318bf commit 22070e7

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

installer/src/main/java/ca/weblite/jdeploy/installer/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private Document getAppXMLDocument() throws IOException {
8080
try (FileInputStream fis = new FileInputStream(appXml)) {
8181
appXMLDocument = parseXml(fis);
8282
} catch (Exception ex) {
83-
throw new IOException("Failed tyo parse app.xml: "+ex.getMessage(), ex);
83+
throw new IOException("Failed to parse app.xml: "+ex.getMessage(), ex);
8484
}
8585
}
8686
return appXMLDocument;

shared/src/main/java/com/joshondesign/appbundler/mac/MacBundler.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import javax.imageio.ImageReader;
3232
import javax.imageio.stream.ImageInputStream;
3333
import net.coobird.thumbnailator.Thumbnails;
34+
import org.apache.commons.io.FileUtils;
3435

3536
/**
3637
* Created by IntelliJ IDEA.
@@ -161,7 +162,23 @@ public static BundlerResult start(AppDescription app, String dest_dir, String re
161162
if (/*codesignClient == null &&*/ app.isMacCodeSigningEnabled()) {
162163
//codesign --deep --verbose=4 -f -s "$CERT" "$1"
163164
System.out.println("Signing "+appDir.getAbsolutePath());
164-
ProcessBuilder pb = new ProcessBuilder("/usr/bin/codesign", "--deep", "--verbose=4", "-f", "--options", "runtime", "-s", app.getMacCertificateName(), appDir.getAbsolutePath());
165+
166+
File entitlementsFile = new File("jdeploy.mac.bundle.entitlements");
167+
if (!entitlementsFile.exists()) {
168+
entitlementsFile = File.createTempFile("jdeploy.mac.bundle", ".entitlements");
169+
entitlementsFile.deleteOnExit();
170+
FileUtils.copyInputStreamToFile(MacBundler.class.getResourceAsStream("mac.bundle.entitlements"), entitlementsFile);
171+
}
172+
ProcessBuilder pb = new ProcessBuilder("/usr/bin/codesign",
173+
"--deep",
174+
"--verbose=4",
175+
"-f",
176+
"--options", "runtime",
177+
"-s", app.getMacCertificateName(),
178+
"--entitlements", entitlementsFile.getAbsolutePath(),
179+
appDir.getAbsolutePath());
180+
181+
165182
pb.inheritIO();
166183
Process p = pb.start();
167184
int exitCode = p.waitFor();
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
6+
<!-- Allow your application read/write access to the file selected by the user. -->
7+
<key>com.apple.security.files.user-selected.read-write</key>
8+
<true/>
9+
<key>com.apple.security.files.bookmarks.app-scope</key>
10+
<true/>
11+
<key>com.apple.security.network.client</key>
12+
<true/>
13+
<key>com.apple.security.print</key>
14+
<true/>
15+
16+
<key>com.apple.security.cs.allow-jit</key>
17+
<true/>
18+
19+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
20+
<true/>
21+
<key>com.apple.security.cs.disable-executable-page-protection</key>
22+
<true/>
23+
<key>com.apple.security.cs.disable-library-validation</key>
24+
<true/>
25+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
26+
<true/>
27+
<key>com.apple.security.automation.apple-events</key>
28+
<true/>
29+
30+
</dict>
31+
</plist>

0 commit comments

Comments
 (0)