Skip to content

Commit 2825320

Browse files
committed
Update PackageMojo.java
1 parent bc5c4da commit 2825320

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/io/github/fvarrui/javapackager/PackageMojo.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,12 @@ private void generateDmgImage() throws MojoExecutionException {
883883
// mounts image
884884
getLog().info("Mounting image: " + tempDmgFile.getAbsolutePath());
885885
String result = CommandUtils.execute("hdiutil", "attach", "-readwrite", "-noverify", "-noautoopen", tempDmgFile);
886-
String deviceName = Arrays.asList(result.split("\n")).stream().filter(s -> s.startsWith("/dev/")).findFirst().get();
886+
String deviceName = Arrays.asList(result.split("\n"))
887+
.stream()
888+
.filter(s -> s.endsWith(mountFolder.getAbsolutePath()))
889+
.map(s -> StringUtils.normalizeSpace(s))
890+
.map(s -> s.split(" ")[0])
891+
.findFirst().get();
887892
getLog().info("- Device name: " + deviceName);
888893

889894
// rendering applescript
@@ -925,7 +930,7 @@ private void generateDmgImage() throws MojoExecutionException {
925930

926931
// compress image
927932
getLog().info("Compressing disk image...");
928-
CommandUtils.execute("hdiutil", "convert", tempDmgFile, "-format", "UDZO", "zlib-level=9", "-o", dmgFile);
933+
CommandUtils.execute("hdiutil", "convert", tempDmgFile, "-format", "UDZO zlib-level=9", "-o", dmgFile);
929934
tempDmgFile.delete();
930935

931936
getLog().info("DMG disk image file generated!");

0 commit comments

Comments
 (0)