-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_dmg.sh
More file actions
executable file
·80 lines (70 loc) · 2.63 KB
/
Copy pathmake_dmg.sh
File metadata and controls
executable file
·80 lines (70 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
set -euo pipefail
# DMG 패키저 — 다른 사용자가 다운로드해서 드래그로 설치할 수 있는 dmg.
#
# dmg 안 구성:
# - PL87W LED Control.app
# - Applications (심볼릭 링크)
#
# 앱은 Developer ID 서명 + 공증을 받았으므로 .app 을 Applications 로 드래그하면
# 별도 우회 없이 바로 실행된다.
ROOT="$(cd "$(dirname "$0")" && pwd)"
APP="$ROOT/build/PL87W LED Control.app"
DMG="$ROOT/build/PL87W_LED_Control.dmg"
STAGE="$ROOT/build/dmg-stage"
VOLNAME="PL87W LED Control"
NOTARY_PROFILE="${NOTARY_PROFILE:-PL87W}"
if [ ! -d "$APP" ]; then
echo "앱 번들이 없어요. build.sh 를 먼저 실행합니다…"
"$ROOT/build.sh"
fi
# 0) 앱 공증 (notarization) + staple
# Apple 공증 서버에 .app 을 제출해 악성코드 스캔을 통과시키고, 발급된 티켓을
# 번들에 부착(staple)한다. 이렇게 하면 오프라인에서도 Gatekeeper 검증을 즉시
# 통과하므로, 사용자는 quarantine 제거 없이 더블 클릭으로 바로 실행할 수 있다.
echo "▶ 앱 공증 중… (Apple 서버 왕복, 수 분 소요)"
ZIP="$ROOT/build/PL87W_notarize.zip"
rm -f "$ZIP"
ditto -c -k --keepParent "$APP" "$ZIP"
xcrun notarytool submit "$ZIP" --keychain-profile "$NOTARY_PROFILE" --wait
rm -f "$ZIP"
xcrun stapler staple "$APP"
echo "▶ 앱 staple 완료"
# 1) staging
rm -rf "$STAGE"
mkdir -p "$STAGE"
cp -R "$APP" "$STAGE/"
ln -s /Applications "$STAGE/Applications"
# 2) DMG 생성 (UDZO = compressed)
rm -f "$DMG"
hdiutil create \
-volname "$VOLNAME" \
-srcfolder "$STAGE" \
-ov \
-format UDZO \
-fs HFS+ \
"$DMG" >/dev/null
# 4) staging 정리
rm -rf "$STAGE"
# 5) dmg 공증 + staple
# .app 은 이미 stapled 이지만, dmg 컨테이너 자체도 공증·staple 해두면 사용자가
# dmg 를 다운로드해 마운트하는 단계에서부터 Gatekeeper 경고가 전혀 뜨지 않는다.
echo "▶ dmg 공증 중… (Apple 서버 왕복, 수 분 소요)"
xcrun notarytool submit "$DMG" --keychain-profile "$NOTARY_PROFILE" --wait
xcrun stapler staple "$DMG"
echo "▶ dmg staple 완료"
# 6) 최종 검증 — dmg staple 확인 + 마운트 후 내부 앱 Gatekeeper 평가
echo ""
echo "▶ dmg staple 검증:"
xcrun stapler validate "$DMG" 2>&1 || true
echo "▶ 내부 앱 Gatekeeper 평가 (accepted / Notarized Developer ID 여야 정상):"
_MNT=$(mktemp -d)
hdiutil attach "$DMG" -nobrowse -quiet -mountpoint "$_MNT"
spctl -a -vvv "$_MNT/PL87W LED Control.app" 2>&1 || true
hdiutil detach "$_MNT" -quiet
rmdir "$_MNT" 2>/dev/null || true
echo ""
echo "DMG 생성 완료:"
ls -lh "$DMG"
echo ""
echo "사용자에게 배포할 파일: $DMG"