Skip to content

Commit 614d0f3

Browse files
committed
Rework macOS signing for Alchemy app layout and libs
1 parent 9d8bb0f commit 614d0f3

File tree

2 files changed

+82
-43
lines changed

2 files changed

+82
-43
lines changed

sign-pkg-mac/action.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: sign-pkg-mac
22
description:
3-
Sign and package the macOS Linden viewer.
3+
Sign and package the macOS Alchemy viewer.
44

55
inputs:
66
imagename:
@@ -39,7 +39,7 @@ inputs:
3939
description: "setting for all steps"
4040
type: string
4141
required: false
42-
default: "Second Life"
42+
default: "Alchemy"
4343

4444
runs:
4545
using: composite
@@ -161,6 +161,7 @@ runs:
161161
- name: Package the sparseimage as .dmg
162162
shell: bash
163163
run: |
164+
barkbarkbarkbark
164165
set -x
165166
mkdir -p .installer
166167
installer=".installer/${{ inputs.imagename }}.dmg"

sign-pkg-mac/sign.sh

Lines changed: 79 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
mydir="$(dirname "$0")"
1313
app_path="$1"
1414

15-
# shellcheck disable=SC1091
16-
. "$mydir/retry_loop"
17-
1815
gotall=true
1916
for var in app_path cert_base64 cert_name cert_pass note_user note_pass note_team
2017
do
@@ -32,7 +29,6 @@ set -x -e
3229
# ****************************************************************************
3330
# The following is derived from
3431
# https://federicoterzi.com/blog/automatic-code-signing-and-notarization-for-macos-apps-using-github-actions/
35-
# shellcheck disable=SC2154
3632
base64 --decode > certificate.p12 <<< "$cert_base64"
3733

3834
# We need to create a new keychain, otherwise using the certificate will prompt
@@ -47,54 +43,94 @@ sleep 1
4743
security create-keychain -p "$keychain_pass" viewer.keychain
4844
security default-keychain -s viewer.keychain
4945
security unlock-keychain -p "$keychain_pass" viewer.keychain
50-
# shellcheck disable=SC2154
51-
security import certificate.p12 -k viewer.keychain -P "$cert_pass" \
52-
-T /usr/bin/codesign
53-
security set-key-partition-list -S 'apple-tool:,apple:,codesign:' -s \
54-
-k "$keychain_pass" viewer.keychain
46+
security import certificate.p12 -k viewer.keychain -P "$cert_pass" -T /usr/bin/codesign
47+
security set-key-partition-list -S 'apple-tool:,apple:,codesign:' -s -k "$keychain_pass" viewer.keychain
5548
rm certificate.p12
5649

57-
# ****************************************************************************
58-
# sign executables
59-
# ****************************************************************************
60-
# arrange to retry signing, since empirically this is a
61-
# low-reliability operation
62-
retries=3
63-
signwait=15
64-
function signloop() {
65-
# save +x / -x state and suppress
66-
xtrace="$(set +o | grep xtrace)"
67-
set +x
68-
# shellcheck disable=SC2064
69-
trap "$xtrace" RETURN
70-
71-
local exe
72-
# we pass the executable to sign as the last argument
73-
# shellcheck disable=SC1083
74-
eval exe=\${$#}
75-
exe="$(basename "$exe")"
76-
retry_loop "$exe signing" $retries $signwait /usr/bin/codesign "$@"
77-
}
50+
# We sign from the inside out
51+
52+
# Plugin bundle
53+
plugin_path="$app_path/Contents/Resources/SLPlugin.app"
54+
plugin_contents="$plugin_path/Contents"
55+
56+
# VLC plugin
57+
for signee in \
58+
"$plugin_contents"/Frameworks/libvlccore.dylib \
59+
"$plugin_contents"/Frameworks/libvlccore.9.dylib \
60+
"$plugin_contents"/Frameworks/libvlc.dylib \
61+
"$plugin_contents"/Frameworks/libvlc.5.dylib \
62+
"$plugin_contents"/Frameworks/plugins/*.dylib \
63+
"$plugin_contents"/Frameworks/plugins/*.dat \
64+
"$plugin_contents"/Frameworks/media_plugin_libvlc.dylib
65+
do
66+
codesign --verbose --force --timestamp --keychain viewer.keychain \
67+
--sign "$cert_name" "$signee"
68+
done
69+
70+
# CEF plugin
71+
for signee in \
72+
"$plugin_contents/Frameworks/Chromium Embedded Framework.framework/Libraries"/*.dylib \
73+
"$plugin_contents/Frameworks/Chromium Embedded Framework.framework/Resources"/*.bin \
74+
"$plugin_contents/Frameworks/Chromium Embedded Framework.framework" \
75+
"$plugin_contents"/Frameworks/media_plugin_cef.dylib
76+
do
77+
codesign --verbose --force --timestamp --keychain viewer.keychain \
78+
--sign "$cert_name" "$signee"
79+
done
80+
81+
# DullahanHelper and SLPlugin
82+
for signee in \
83+
"$plugin_contents/Frameworks"/DullahanHelper*.app \
84+
"$plugin_path"
85+
do
86+
codesign --verbose --force \
87+
--entitlements "$mydir/installer/slplugin.entitlements" \
88+
--options runtime --keychain viewer.keychain \
89+
--sign "$cert_name" "$signee"
90+
done
7891

92+
# Resources
7993
resources="$app_path/Contents/Resources"
80-
# plain signing
94+
95+
# SLVoice Libs
96+
for signee in \
97+
"$resources"/libortp.dylib \
98+
"$resources"/libvivoxsdk.dylib
99+
do
100+
codesign --verbose --force --timestamp --keychain viewer.keychain \
101+
--sign "$cert_name" "$signee"
102+
done
103+
104+
# SLVoice binary
81105
for signee in \
82-
"$resources"/*.dylib \
83-
"$resources"/llplugin/*.dylib \
84-
"$app_path/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries"/*.dylib
106+
"$resources/SLVoice"
85107
do
86-
# shellcheck disable=SC2154
87-
signloop --force --timestamp --keychain viewer.keychain \
108+
codesign --verbose --force \
109+
--entitlements "$mydir/installer/slplugin.entitlements" \
110+
--options runtime --keychain viewer.keychain \
88111
--sign "$cert_name" "$signee"
89112
done
90-
# deep signing
113+
114+
# App Frameworks
115+
frameworks="$app_path/Contents/Frameworks"
116+
for signee in \
117+
"$frameworks"/libopenal.dylib \
118+
"$frameworks"/libalut.dylib \
119+
"$frameworks"/libfmod.dylib \
120+
"$frameworks"/libdiscord_partner_sdk.dylib \
121+
"$frameworks"/libndofdev.dylib \
122+
"$frameworks"/libSDL3.dylib \
123+
"$frameworks"/libllwebrtc.dylib
124+
do
125+
codesign --verbose --force --timestamp --keychain viewer.keychain \
126+
--sign "$cert_name" "$signee"
127+
done
128+
129+
# App Signing
91130
for signee in \
92-
"$resources/updater/SLVersionChecker" \
93-
"$resources/SLPlugin.app/Contents/MacOS/SLPlugin" \
94-
"$resources/SLVoice" \
95131
"$app_path"
96132
do
97-
signloop --verbose --deep --force \
133+
codesign --verbose --force \
98134
--entitlements "$mydir/installer/slplugin.entitlements" \
99135
--options runtime --keychain viewer.keychain \
100136
--sign "$cert_name" "$signee"
@@ -160,3 +196,5 @@ set -e
160196
# available.
161197
echo "Attach staple"
162198
xcrun stapler staple "$app_path"
199+
200+
spctl -a -texec -vvvv "$app_path"

0 commit comments

Comments
 (0)