--- old/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacDmgBundler.java 2020-05-13 09:52:50.422201900 -0400 +++ new/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacDmgBundler.java 2020-05-13 09:52:48.606763200 -0400 @@ -310,19 +310,29 @@ File mountedRoot = new File(imagesRoot.getAbsolutePath(), APP_NAME.fetchFrom(params)); - try { - // volume icon - File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns"); - IOUtils.copyFile(getConfig_VolumeIcon(params), - volumeIconFile); - // background image File bgdir = new File(mountedRoot, BACKGROUND_IMAGE_FOLDER); bgdir.mkdirs(); IOUtils.copyFile(getConfig_VolumeBackground(params), new File(bgdir, BACKGROUND_IMAGE)); + // We will not consider setting background image and creating link + // to install-dir in DMG as critical error, since it can fail in + // headless enviroment. + try { + pb = new ProcessBuilder("osascript", + getConfig_VolumeScript(params).getAbsolutePath()); + IOUtils.exec(pb); + } catch (IOException ex) { + Log.verbose(ex); + } + + // volume icon + File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns"); + IOUtils.copyFile(getConfig_VolumeIcon(params), + volumeIconFile); + // Indicate that we want a custom icon // NB: attributes of the root directory are ignored // when creating the volume @@ -356,16 +366,6 @@ Log.verbose(I18N.getString("message.setfile.dmg")); } - // We will not consider setting background image and creating link to - // /Application folder in DMG as critical error, since it can fail in - // headless enviroment. - try { - pb = new ProcessBuilder("osascript", - getConfig_VolumeScript(params).getAbsolutePath()); - IOUtils.exec(pb); - } catch (IOException ex) { - Log.verbose(ex); - } } finally { // Detach the temporary image pb = new ProcessBuilder( @@ -493,5 +493,4 @@ public boolean isDefault() { return true; } - }