Skip to content

Commit 348a1ab

Browse files
authored
fix(bundler): DMG bundling on macOS 12.3 cannot use bless, closes #3719 (#3721)
1 parent 72f19f8 commit 348a1ab

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.changes/fix-dmg-macos-12.3.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"tauri-bundler": patch
3+
"cli.rs": patch
4+
"cli.js": patch
5+
---
6+
7+
Fixes DMG bundling on macOS 12.3.

tooling/bundler/src/bundle/macos/templates/dmg/bundle_dmg

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ function usage() {
5959
echo " execute hdiutil in verbose mode"
6060
echo " --hdiutil-quiet"
6161
echo " execute hdiutil in quiet mode"
62+
echo " --bless"
63+
echo " bless the mount folder (deprecated, needs macOS 12.2.1 or older)"
6264
echo " --sandbox-safe"
6365
echo " execute hdiutil with sandbox compatibility, do not bless and do not execute the cosmetic AppleScript"
6466
echo " --version show tool version number"
@@ -78,6 +80,7 @@ ADD_FILE_TARGETS=()
7880
IMAGEKEY=""
7981
HDIUTIL_VERBOSITY=""
8082
SANDBOX_SAFE=0
83+
BLESS=0
8184
SKIP_JENKINS=0
8285
MAXIMUM_UNMOUNTING_ATTEMPTS=3
8386
POSITION_CLAUSE=""
@@ -161,6 +164,9 @@ while [[ "${1:0:1}" = "-" ]]; do
161164
--sandbox-safe)
162165
SANDBOX_SAFE=1
163166
shift;;
167+
--bless)
168+
BLESS=1
169+
shift;;
164170
--skip-jenkins)
165171
SKIP_JENKINS=1
166172
shift;;
@@ -285,14 +291,14 @@ MOUNT_DIR="/Volumes/${VOLUME_NAME}"
285291
# Unmount leftover dmg if it was mounted previously (e.g. developer mounted dmg, installed app and forgot to unmount it)
286292
if [[ -d "${MOUNT_DIR}" ]]; then
287293
echo "Unmounting previously mounted disk image..."
288-
DEV_NAME=$(hdiutil info | egrep --color=never '^/dev/' | sed 1q | awk '{print $1}')
294+
DEV_NAME=$(hdiutil info | grep -E --color=never '^/dev/' | sed 1q | awk '{print $1}')
289295
hdiutil detach "${DEV_NAME}"
290296
fi
291297

292298
echo "Mounting disk image..."
293299

294300
echo "Mount directory: $MOUNT_DIR"
295-
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep --color=never '^/dev/' | sed 1q | awk '{print $1}')
301+
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | grep -E --color=never '^/dev/' | sed 1q | awk '{print $1}')
296302
echo "Device name: $DEV_NAME"
297303

298304
if [[ -n "$BACKGROUND_FILE" ]]; then
@@ -374,7 +380,7 @@ chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true
374380
echo "Done fixing permissions."
375381

376382
# make the top window open itself on mount:
377-
if [[ $SANDBOX_SAFE -eq 0 ]]; then
383+
if [[ $BLESS -eq 1 && $SANDBOX_SAFE -eq 0 ]]; then
378384
echo "Blessing started"
379385
bless --folder "${MOUNT_DIR}" --openfolder "${MOUNT_DIR}"
380386
echo "Blessing finished"

0 commit comments

Comments
 (0)