8244576: [macos] Volume icon deleted by osascript for background image

Reviewed-by: asemenyuk, almatvee
This commit is contained in:
Andy Herrick 2020-05-13 16:05:02 -04:00
parent 9768618bab
commit 0cc7f3585f

View File

@ -310,19 +310,29 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
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 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
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 class MacDmgBundler extends MacBaseInstallerBundler {
public boolean isDefault() {
return true;
}
}