Files
hex/scripts/notarize-app.sh
Kit Langton 8184e51aed macOS: lay out the installer window with Hex's keycap (#297)
* macOS: lay out the installer window with Hex's keycap (t423)

The DMG opens on a light window with Hex, an arrow to Applications, and Hex's own dark Option keycap beside "Hold it, say it, done." packaging/macos/dmg holds the background (1x and 2x TIFF), Finder's .DS_Store, and render.sh, which draws the keycap with Rune and regenerates both. scripts/notarize-app.sh lays out the local DMG with them; the Release workflow's DMG follows in a separate .github/ PR.

* Show the whole background: the window height includes its title bar

* Follow the hex rename; satisfy clippy
2026-10-28 12:03:13 -07:00

40 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
set -eu
# Notarize and staple a Developer ID signed app, then wrap it in a signed,
# notarized, and stapled DMG with an Applications link, laid out by
# packaging/macos/dmg (the background and Finder's .DS_Store).
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <app path> <dmg path> <volume name>" >&2
exit 1
fi
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
. "$root/scripts/macos-signing.sh"
bundle=$1
dmg=$2
volume=$3
team_id=${HEX_TEAM_ID:?Set HEX_TEAM_ID to the Apple Developer signing team}
identity=$(hex_codesign_identity "$team_id")
work=$(mktemp -d "${TMPDIR:-/tmp}/hex-notarize.XXXXXX")
trap 'rm -rf "$work"' EXIT HUP INT TERM
# Notarize the app first so its ticket can be stapled inside the distributable DMG.
/usr/bin/ditto -c -k --sequesterRsrc --keepParent "$bundle" "$work/app.zip"
hex_notarize "$work/app.zip"
xcrun stapler staple "$bundle"
xcrun stapler validate "$bundle"
mkdir "$work/staging"
/usr/bin/ditto "$bundle" "$work/staging/$(basename "$bundle")"
ln -s /Applications "$work/staging/Applications"
cp "$root/packaging/macos/dmg/background.tiff" "$work/staging/.background.tiff"
cp "$root/packaging/macos/dmg/DS_Store" "$work/staging/.DS_Store"
rm -f "$dmg"
hdiutil create -quiet -fs APFS -format ULFO -volname "$volume" -srcfolder "$work/staging" "$dmg"
codesign --force --timestamp --sign "$identity" "$dmg"
hex_notarize "$dmg"
xcrun stapler staple "$dmg"
xcrun stapler validate "$dmg"
spctl --assess --type open --context context:primary-signature --verbose=2 "$dmg"