From b71a923dbcd6527d5ceb4c6d82ba52dcc1c79564 Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Wed, 22 Jul 2015 11:50:02 -0500 Subject: [PATCH] Try to resolve 1728 error when attaching --- mac/scripts/build_dist.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/mac/scripts/build_dist.sh b/mac/scripts/build_dist.sh index 0a4d3656b..e20306df5 100755 --- a/mac/scripts/build_dist.sh +++ b/mac/scripts/build_dist.sh @@ -27,11 +27,38 @@ cp -pR "${DSTROOT}/" "${DMG}" #Add a custom icon for the DMG #cp -p mac/Resources/Audacity.icns "${DMG}"/.VolumeIcon.icns +# Make sure it's not already attached +ATTACHED=$(hdiutil info | awk "/\/Volumes\/${VOL}/{print \$1}") +if [ -n "${ATTACHED}" ] +then + hdiutil detach "${ATTACHED}" +fi + # Create and mount the image hdiutil create -ov -format UDRW -srcdir "$DMG" -fs HFS+ -volname "$VOL" TMP.dmg +if [ $? -ne 0 ] +then + echo "Create failed" + exit 1 +fi #Mount the DMG and store the name it was mounted with -TITLE=`hdiutil attach TMP.dmg | grep \/Volumes | sed "s/^.*\/Volumes\///"` +TITLE=$(hdiutil attach TMP.dmg | grep \/Volumes | sed "s/^.*\/Volumes\///") +if [ $? -ne 0 ] +then + echo "Attach failed" + exit 1 +fi + +# And wait for it to show up in Finder +osascript <