Skip to content

Commit 78dd2e8

Browse files
committed
fix(release): detach created DMG before verification
Tool: Codex Model: GPT-5 Why: hdiutil create can leave the release DMG attached, causing immediate verification to fail as busy.
1 parent a7e5231 commit 78dd2e8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tools/release/deploy-stargazer-bar.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ verify_dmg() {
128128
return 1
129129
}
130130

131+
detach_dmg_if_attached() {
132+
local dmg="$1"
133+
local device
134+
135+
device=$(hdiutil info | awk -v path="$dmg" '
136+
$0 ~ "^image-path[[:space:]]*: " path "$" { seen=1; next }
137+
seen && $1 ~ "^/dev/disk" { print $1; exit }
138+
') || true
139+
140+
if [[ -n "$device" ]]; then
141+
hdiutil detach "$device" >/dev/null
142+
fi
143+
}
144+
131145
detect_developer_id() {
132146
if [[ -n "${DEV_ID_APP:-}" ]]; then
133147
return 0
@@ -330,6 +344,7 @@ rm -f "$NOTARY_ZIP"
330344
echo "==> Creating DMG"
331345
rm -f "$DMG"
332346
hdiutil create -volname "$DISPLAY_NAME" -srcfolder "$APP" -ov -format UDZO "$DMG"
347+
detach_dmg_if_attached "$DMG"
333348
codesign --force --sign "$DEV_ID_APP" --timestamp "$DMG"
334349
verify_dmg "$DMG"
335350

0 commit comments

Comments
 (0)