Skip to content

Commit f726624

Browse files
authored
Merge pull request #186 from AstroPixelProcessor/devel
fix hdiutil image creation on aarch64
2 parents 6f3f6fd + 3ae5e0b commit f726624

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/main/java/io/github/fvarrui/javapackager/packagers/GenerateDmg.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,21 @@ protected File doApply(MacPackager packager) throws Exception {
8282
Logger.info("Copying icon file: " + iconFile.getAbsolutePath());
8383
File volumeIcon = (macConfig.getVolumeIcon() != null) ? macConfig.getVolumeIcon() : iconFile;
8484
FileUtils.copyFileToFile(volumeIcon, new File(appFolder, ".VolumeIcon.icns"));
85-
85+
86+
87+
8688
// creates image
8789
Logger.info("Creating image: " + tempDmgFile.getAbsolutePath());
88-
execute("hdiutil", "create", "-srcfolder", appFolder, "-volname", volumeName, "-ov", "-fs", "HFS+", "-format", "UDRW", tempDmgFile);
90+
String osArchitecture = System.getProperty("os.arch");
91+
if (osArchitecture.toLowerCase().equals("aarch64")) {
92+
93+
execute("hdiutil", "create", "-srcfolder", appFolder, "-volname", volumeName, "-ov", "-fs", "APFS", "-format", "UDRW", tempDmgFile);
94+
95+
} else {
96+
97+
execute("hdiutil", "create", "-srcfolder", appFolder, "-volname", volumeName, "-ov", "-fs", "HFS+", "-format", "UDRW", tempDmgFile);
98+
99+
}
89100

90101
if (mountFolder.exists()) {
91102
Logger.info("Unmounting volume: " + mountFolder);
@@ -126,10 +137,12 @@ protected File doApply(MacPackager packager) throws Exception {
126137
// makes sure it's not world writeable and user readable
127138
Logger.info("Fixing permissions...");
128139
execute("chmod", "-Rf", "u+r,go-w", mountFolder);
129-
130-
// makes the top window open itself on mount:
131-
Logger.info("Blessing ...");
132-
execute("bless", "--folder", mountFolder, "--openfolder", mountFolder);
140+
141+
if (!osArchitecture.toLowerCase().equals("aarch64")) {
142+
// makes the top window open itself on mount:
143+
Logger.info("Blessing ...");
144+
execute("bless", "--folder", mountFolder, "--openfolder", mountFolder);
145+
}
133146

134147
// tells the volume that it has a special file attribute
135148
execute("SetFile", "-a", "C", mountFolder);

0 commit comments

Comments
 (0)