Skip to content

Commit

Permalink
Update create-dmg
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Jan 15, 2025
1 parent 54ae1e3 commit 993259c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion BuildTools/macosx/create-dmg/create-dmg
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,24 @@ fi

# unmount
echo "Unmounting disk image..."
hdiutil detach "${DEV_NAME}"
# Add retry logic for unmounting
MAX_ATTEMPTS=5
ATTEMPT=1
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
if hdiutil detach "${DEV_NAME}" 2>/dev/null; then
echo "Disk image successfully unmounted"
break
else
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS: Failed to unmount disk image, retrying in 2 seconds..."
sleep 2
ATTEMPT=$((ATTEMPT + 1))
fi
done

if [ $ATTEMPT -gt $MAX_ATTEMPTS ]; then
echo "Failed to unmount disk image after $MAX_ATTEMPTS attempts"
exit 1
fi

# compress image
echo "Compressing disk image..."
Expand Down

0 comments on commit 993259c

Please sign in to comment.