Permalink
Browse files

Merge pull request #15 from nordligulv/master

unmount dmg in the start of the build
  • Loading branch information...
2 parents 16f0ad7 + 65f5068 commit 755381fd47802a2bf08307b9c583e775d785a08e @andreyvit committed Apr 1, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 create-dmg
View
6 create-dmg
@@ -137,6 +137,12 @@ hdiutil create -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" -fs HFS+ -fsar
# mount it
echo "Mounting disk image..."
MOUNT_DIR="/Volumes/${VOLUME_NAME}"
+
+# try unmount dmg if it was mounted previously (e.g. developer mounted dmg, installed app and forgot to unmount it)
+echo "Unmounting disk image..."
+DEV_NAME=$(hdiutil info | egrep '^/dev/' | sed 1q | awk '{print $1}')
+test -d "${MOUNT_DIR}" && hdiutil detach "${DEV_NAME}"
+
echo "Mount directory: $MOUNT_DIR"
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}')
echo "Device name: $DEV_NAME"

0 comments on commit 755381f

Please sign in to comment.