Skip to content

Commit

Permalink
macos builds will succeed even if there is a volume with the target n…
Browse files Browse the repository at this point in the history
…ame already mounted
  • Loading branch information
abstraktor committed Sep 28, 2018
1 parent 0d45b14 commit 24e832c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/main/resources/de/itemis/mps/gradle/mpsdmg.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 7 additions & 5 deletions src/main/resources/de/itemis/mps/gradle/mpsdmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 24e832c

Please sign in to comment.