From 24e832c4d4acc272b70663c9b64c87cc1c12cb5e Mon Sep 17 00:00:00 2001 From: Bastian Kruck Date: Fri, 28 Sep 2018 18:03:10 +0200 Subject: [PATCH] macos builds will succeed even if there is a volume with the target name already mounted --- src/main/resources/de/itemis/mps/gradle/mpsdmg.pl | 9 +++++---- src/main/resources/de/itemis/mps/gradle/mpsdmg.sh | 12 +++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/resources/de/itemis/mps/gradle/mpsdmg.pl b/src/main/resources/de/itemis/mps/gradle/mpsdmg.pl index 8a70767..ec4ac55 100644 --- a/src/main/resources/de/itemis/mps/gradle/mpsdmg.pl +++ b/src/main/resources/de/itemis/mps/gradle/mpsdmg.pl @@ -4,17 +4,18 @@ use Mac::Memory qw( ); use Mac::Files qw( NewAliasMinimal ); -$name = $ARGV[0]; -$bg_pic = $ARGV[1]; +$volumeName = $ARGV[0]; +$name = $ARGV[1]; +$bg_pic = $ARGV[2]; -&writeDSDBEntries("/Volumes/$name/.DS_Store", +&writeDSDBEntries("/Volumes/$volumeName/.DS_Store", &makeEntries(".background", Iloc_xy => [ 560, 170 ]), &makeEntries(".DS_Store", Iloc_xy => [ 610, 170 ]), &makeEntries(".fseventsd", Iloc_xy => [ 660, 170 ]), &makeEntries(".Trashes", Iloc_xy => [ 710, 170 ]), &makeEntries(" ", Iloc_xy => [ 335, 120 ]), &makeEntries(".", - BKGD_alias => NewAliasMinimal("/Volumes/$name/.background/$bg_pic"), + BKGD_alias => NewAliasMinimal("/Volumes/$volumeName/.background/$bg_pic"), ICVO => 1, fwi0_flds => [ 100, 400, 396, 855, "icnv", 0, 0 ], fwsw => 170, diff --git a/src/main/resources/de/itemis/mps/gradle/mpsdmg.sh b/src/main/resources/de/itemis/mps/gradle/mpsdmg.sh index 555d076..12787aa 100755 --- a/src/main/resources/de/itemis/mps/gradle/mpsdmg.sh +++ b/src/main/resources/de/itemis/mps/gradle/mpsdmg.sh @@ -44,16 +44,18 @@ hdiutil create -srcfolder "$INPUT_DIR" -volname "$VOLNAME" -anyowners -nospotlig # mount this image echo "Mounting unpacked r/w disk image..." -device=$(hdiutil attach -readwrite -noverify -noautoopen "$temp_dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}') -echo "Mounted as $device." +DEVICE_DETAILS=$(hdiutil attach -readwrite -noverify -noautoopen "$temp_dmg") +DEVICE_NAME=$(echo $DEVICE_DETAILS | egrep '^/dev/' | sed 1q | awk '{print $1}') +TMP_VOL_PATH=$(echo $DEVICE_DETAILS | egrep -o '/Volumes/.*$') +echo "Mounted as $DEVICE_NAME under $TMP_VOL_PATH." sleep 10 # set properties echo "Updating disk image styles..." -rm "/Volumes/$VOLNAME/DSStorePlaceHolder" -arch -32 perl5.18 mpsdmg.pl "$VOLNAME" $(basename "$BG_PIC") +rm "$TMP_VOL_PATH/DSStorePlaceHolder" +arch -32 perl5.18 mpsdmg.pl "$(basename "$TMP_VOL_PATH")" "$VOLNAME" $(basename "$BG_PIC") sync;sync;sync -hdiutil detach "$device" +hdiutil detach "$DEVICE_NAME" echo "Compressing r/w disk image to $OUTPUT_FILE..." rm -f "$OUTPUT_FILE"