< prev index next >

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgBundler.java

Print this page

        

*** 92,103 **** //prepare config for exe Map<String, String> data = new HashMap<>(); data.put("DEPLOY_ACTUAL_VOLUME_NAME", volumeName); data.put("DEPLOY_APPLICATION_NAME", APP_NAME.fetchFrom(params)); ! data.put("DEPLOY_INSTALL_LOCATION", "(path to desktop folder)"); ! data.put("DEPLOY_INSTALL_NAME", "Desktop"); try (Writer w = Files.newBufferedWriter(dmgSetup.toPath())) { w.write(preprocessTextResource(dmgSetup.getName(), I18N.getString("resource.dmg-setup-script"), DEFAULT_DMG_SETUP_SCRIPT, data, VERBOSE.fetchFrom(params), --- 92,103 ---- //prepare config for exe Map<String, String> data = new HashMap<>(); data.put("DEPLOY_ACTUAL_VOLUME_NAME", volumeName); data.put("DEPLOY_APPLICATION_NAME", APP_NAME.fetchFrom(params)); ! data.put("DEPLOY_INSTALL_LOCATION", "(path to applications folder)"); ! data.put("DEPLOY_INSTALL_NAME", "Applications"); try (Writer w = Files.newBufferedWriter(dmgSetup.toPath())) { w.write(preprocessTextResource(dmgSetup.getName(), I18N.getString("resource.dmg-setup-script"), DEFAULT_DMG_SETUP_SCRIPT, data, VERBOSE.fetchFrom(params),
*** 317,334 **** IOUtils.exec(pb); File mountedRoot = new File(imagesRoot.getAbsolutePath(), APP_NAME.fetchFrom(params)); // volume icon File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns"); IOUtils.copyFile(getConfig_VolumeIcon(params), volumeIconFile); ! pb = new ProcessBuilder("osascript", ! getConfig_VolumeScript(params).getAbsolutePath()); ! IOUtils.exec(pb); // Indicate that we want a custom icon // NB: attributes of the root directory are ignored // when creating the volume // Therefore we have to do this after we mount image --- 317,337 ---- IOUtils.exec(pb); 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"); ! bgdir.mkdirs(); ! IOUtils.copyFile(getConfig_VolumeBackground(params), ! new File(bgdir, "background.png")); // Indicate that we want a custom icon // NB: attributes of the root directory are ignored // when creating the volume // Therefore we have to do this after we mount image
*** 360,377 **** --- 363,392 ---- } } else { 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( hdiutil, "detach", "-force", hdiUtilVerbosityFlag, mountedRoot.getAbsolutePath()); IOUtils.exec(pb); + } // Compress it to a new image pb = new ProcessBuilder( hdiutil, "convert",
< prev index next >