@@ -310,19 +310,29 @@ private File buildDMG(
310
310
311
311
File mountedRoot = new File (imagesRoot .getAbsolutePath (),
312
312
APP_NAME .fetchFrom (params ));
313
-
314
313
try {
315
- // volume icon
316
- File volumeIconFile = new File (mountedRoot , ".VolumeIcon.icns" );
317
- IOUtils .copyFile (getConfig_VolumeIcon (params ),
318
- volumeIconFile );
319
-
320
314
// background image
321
315
File bgdir = new File (mountedRoot , BACKGROUND_IMAGE_FOLDER );
322
316
bgdir .mkdirs ();
323
317
IOUtils .copyFile (getConfig_VolumeBackground (params ),
324
318
new File (bgdir , BACKGROUND_IMAGE ));
325
319
320
+ // We will not consider setting background image and creating link
321
+ // to install-dir in DMG as critical error, since it can fail in
322
+ // headless enviroment.
323
+ try {
324
+ pb = new ProcessBuilder ("osascript" ,
325
+ getConfig_VolumeScript (params ).getAbsolutePath ());
326
+ IOUtils .exec (pb );
327
+ } catch (IOException ex ) {
328
+ Log .verbose (ex );
329
+ }
330
+
331
+ // volume icon
332
+ File volumeIconFile = new File (mountedRoot , ".VolumeIcon.icns" );
333
+ IOUtils .copyFile (getConfig_VolumeIcon (params ),
334
+ volumeIconFile );
335
+
326
336
// Indicate that we want a custom icon
327
337
// NB: attributes of the root directory are ignored
328
338
// when creating the volume
@@ -356,16 +366,6 @@ private File buildDMG(
356
366
Log .verbose (I18N .getString ("message.setfile.dmg" ));
357
367
}
358
368
359
- // We will not consider setting background image and creating link to
360
- // /Application folder in DMG as critical error, since it can fail in
361
- // headless enviroment.
362
- try {
363
- pb = new ProcessBuilder ("osascript" ,
364
- getConfig_VolumeScript (params ).getAbsolutePath ());
365
- IOUtils .exec (pb );
366
- } catch (IOException ex ) {
367
- Log .verbose (ex );
368
- }
369
369
} finally {
370
370
// Detach the temporary image
371
371
pb = new ProcessBuilder (
@@ -493,5 +493,4 @@ public static boolean isSupported() {
493
493
public boolean isDefault () {
494
494
return true ;
495
495
}
496
-
497
496
}
0 commit comments