forked from garglk/garglk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign-osx.sh
executable file
·62 lines (56 loc) · 1.5 KB
/
sign-osx.sh
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
#!/bin/bash
set -e
operation=""
while getopts "bhns:v" o
do
case "${o}" in
b)
operation="bundle"
;;
n)
operation="notarize"
;;
s)
operation="status"
req_uuid="${OPTARG}"
;;
v)
operation="verify"
;;
*)
exit 1
;;
esac
done
function die() {
echo "${1}"
exit 1
}
[[ -d "Gargoyle.app" ]] || die "Gargoyle.app does not exist"
[[ -n "${CERT_NAME}" ]] || die "\${CERT_NAME} not provided"
[[ -n "${APPLE_ID}" ]] || die "\${APPLE_ID} not provided"
[[ -n "${PROV_SHORT_NAME}" ]] || die "\${PROV_SHORT_NAME} not provided"
case "${operation}" in
"notarize")
codesign -f -o runtime --deep --sign "${CERT_NAME}" Gargoyle.app
ditto -c -k --keepParent Gargoyle.app Gargoyle.zip
xcrun altool --notarize-app --primary-bundle-id 'com.googlecode.garglk.Launcher' --username "${APPLE_ID}" --asc-provider "${PROV_SHORT_NAME}" --file Gargoyle.zip
;;
"bundle")
xcrun stapler staple Gargoyle.app
rm -f gargoyle-2023.1-mac.dmg
hdiutil create -fs "HFS+J" -ov -srcfolder Gargoyle.app/ gargoyle-2023.1-mac.dmg
;;
"status")
xcrun altool --notarization-info "${req_uuid}" -u "${APPLE_ID}"
;;
"verify")
codesign -d --verbose=4 Gargoyle.app
;;
"")
die "No operation requested"
;;
*)
die "Unknown operation: ${operation}"
;;
esac