Fix hdiutil Resource Busy: retry loop + Spotlight indexing prevention
Adds .metadata_never_index to staging dir and retries hdiutil create up to 3 times to handle transient "Resource busy" failures from Spotlight/fseventsd locking the source folder. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
c9492c90ea
commit
9cd70549ca
+17
-4
@@ -34,10 +34,23 @@ ln -s /Applications "$STAGING_DIR/Applications"
|
|||||||
echo "Creating DMG..."
|
echo "Creating DMG..."
|
||||||
hdiutil detach /Volumes/Galaxy -force 2>/dev/null || true
|
hdiutil detach /Volumes/Galaxy -force 2>/dev/null || true
|
||||||
rm -f "$DMG_PATH"
|
rm -f "$DMG_PATH"
|
||||||
hdiutil create -volname "Galaxy" \
|
# Prevent Spotlight/fseventsd from locking the staging dir
|
||||||
-srcfolder "$STAGING_DIR" \
|
touch "$STAGING_DIR/.metadata_never_index"
|
||||||
-ov -format UDZO \
|
sleep 1
|
||||||
"$DMG_PATH"
|
for attempt in 1 2 3; do
|
||||||
|
if hdiutil create -volname "Galaxy" \
|
||||||
|
-srcfolder "$STAGING_DIR" \
|
||||||
|
-ov -format UDZO \
|
||||||
|
"$DMG_PATH"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ "$attempt" -eq 3 ]; then
|
||||||
|
echo "Error: hdiutil create failed after 3 attempts"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "hdiutil failed (attempt $attempt/3), retrying in 3s..."
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
|
||||||
echo "Signing DMG..."
|
echo "Signing DMG..."
|
||||||
codesign --force --sign "$SIGNING_IDENTITY" --timestamp "$DMG_PATH"
|
codesign --force --sign "$SIGNING_IDENTITY" --timestamp "$DMG_PATH"
|
||||||
|
|||||||
Reference in New Issue
Block a user