Skip to content

Commit 6ae38b6

Browse files
committed
codesign_identity
1 parent 3430a59 commit 6ae38b6

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

build.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ exe = EXE(pyz,
4040
console=False,
4141
disable_windowed_traceback=False,
4242
target_arch=None,
43-
codesign_identity=None,
43+
codesign_identity=MacDeveloperID,
4444
entitlements_file=None)
4545
coll = COLLECT(exe,
4646
a.binaries,

pkg.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
appName="PyThub PyInstaller Desktop"
4+
# MacDeveloperID="3rd Party Mac Developer Installer: Developer Name (XXXX)"
5+
MacDeveloperID="Developer ID Installer: CROGRAM INC. (4LWSS9P873)"
6+
7+
# rm -rf ./build/pkg
8+
mkdir ./build/pkg
9+
10+
appPath=./dist/"$appName".app
11+
pkgPath=./dist/"$appName".pkg
12+
13+
14+
# 生成中间 PKG 文件
15+
pkgbuild --install-location /Applications --component "$appPath" ./build/pkg/intermediate.pkg
16+
17+
cd ./build/pkg
18+
19+
# 创建分发 XML 文件
20+
productbuild --synthesize --package ./intermediate.pkg ./distribution.xml
21+
22+
# 生成最终的 PKG 文件。此 PKG 文件未签名
23+
productbuild --distribution ./distribution.xml --package-path ./intermediate.pkg ./unsigned_final.pkg
24+
25+
26+
if ["$MacDeveloperID" = ""]; then
27+
# 未签名
28+
mv ./unsigned_final.pkg ./final.pkg
29+
else
30+
# 使用 Mac 开发人员 ID 证书对 PKG 文件进行签名
31+
productsign --sign "$MacDeveloperID" ./unsigned_final.pkg ./signed_final.pkg
32+
mv ./signed_final.pkg ./final.pkg
33+
fi
34+
35+
cd -
36+
37+
# rm "$pkgPath"
38+
mv ./build/pkg/final.pkg "$pkgPath"

0 commit comments

Comments
 (0)