< prev index next >

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

Print this page




 429                     IOUtils.exec(pb);
 430                 } catch (IOException ex) {
 431                     Log.error(ex.getMessage());
 432                     Log.verbose("Cannot enable custom icon using SetFile utility");
 433                 }
 434             } else {
 435                 Log.verbose(I18N.getString("message.setfile.dmg"));
 436             }
 437 
 438         } finally {
 439             // Detach the temporary image
 440             pb = new ProcessBuilder(
 441                     hdiutil,
 442                     "detach",
 443                     "-force",
 444                     hdiUtilVerbosityFlag,
 445                     mountedRoot.toAbsolutePath().toString());
 446             // "hdiutil detach" might not work right away due to resource busy error, so
 447             // repeat detach several times.
 448             RetryExecutor retryExecutor = new RetryExecutor();







 449             // 10 times with 3 second delays.
 450             retryExecutor.setMaxAttemptsCount(10).setAttemptTimeoutMillis(3000)
 451                     .execute(pb);
 452         }
 453 
 454         // Compress it to a new image
 455         pb = new ProcessBuilder(
 456                 hdiutil,
 457                 "convert",
 458                 protoDMG.toAbsolutePath().toString(),
 459                 hdiUtilVerbosityFlag,
 460                 "-format", "UDZO",
 461                 "-o", finalDMG.toAbsolutePath().toString());
 462         IOUtils.exec(pb);
 463 
 464         //add license if needed
 465         if (Files.exists(getConfig_LicenseFile(params))) {
 466             //hdiutil unflatten your_image_file.dmg
 467             pb = new ProcessBuilder(
 468                     hdiutil,




 429                     IOUtils.exec(pb);
 430                 } catch (IOException ex) {
 431                     Log.error(ex.getMessage());
 432                     Log.verbose("Cannot enable custom icon using SetFile utility");
 433                 }
 434             } else {
 435                 Log.verbose(I18N.getString("message.setfile.dmg"));
 436             }
 437 
 438         } finally {
 439             // Detach the temporary image
 440             pb = new ProcessBuilder(
 441                     hdiutil,
 442                     "detach",
 443                     "-force",
 444                     hdiUtilVerbosityFlag,
 445                     mountedRoot.toAbsolutePath().toString());
 446             // "hdiutil detach" might not work right away due to resource busy error, so
 447             // repeat detach several times.
 448             RetryExecutor retryExecutor = new RetryExecutor();
 449             // Image can get detach even if we got resource busy error, so stop
 450             // trying to detach it if it is no longer attached.
 451             retryExecutor.setExecutorInitializer(exec -> {
 452                 if (!Files.exists(mountedRoot)) {
 453                     retryExecutor.stop();
 454                 }
 455             });
 456             // 10 times with 3 second delays.
 457             retryExecutor.setMaxAttemptsCount(10).setAttemptTimeoutMillis(3000)
 458                     .execute(pb);
 459         }
 460 
 461         // Compress it to a new image
 462         pb = new ProcessBuilder(
 463                 hdiutil,
 464                 "convert",
 465                 protoDMG.toAbsolutePath().toString(),
 466                 hdiUtilVerbosityFlag,
 467                 "-format", "UDZO",
 468                 "-o", finalDMG.toAbsolutePath().toString());
 469         IOUtils.exec(pb);
 470 
 471         //add license if needed
 472         if (Files.exists(getConfig_LicenseFile(params))) {
 473             //hdiutil unflatten your_image_file.dmg
 474             pb = new ProcessBuilder(
 475                     hdiutil,


< prev index next >