@@ -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