Skip to content

armgit / muxin

Public Imported from GitHub
0

All your machines, one app. For you and your AI agents: agent sessions, desktops, files, logs and GitHub across your Macs, Linux and Windows machines, with an MCP server.

Signing scripts: pick the certificate by fingerprint

Adib Hanna3946652791c2
diff --git a/scripts/build-agents.sh b/scripts/build-agents.sh
index e8ff3e5..dce9b13 100755
--- a/scripts/build-agents.sh
+++ b/scripts/build-agents.sh
@@ -27,8 +27,9 @@ case "$(uname -s)" in
build x86_64-apple-darwin darwin-x86_64 build
# Signed with a stable identity, a Mac keeps the agent's Screen Recording
# and Accessibility permissions across updates (an ad-hoc signature
- # changes with every build, and the permissions go with it).
- identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -n1)}
+ # changes with every build, and the permissions go with it). By fingerprint:
+ # a keychain can hold several certificates of the same name.
+ identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/^ *[0-9][0-9]*) \([0-9A-F]\{40\}\) "Developer ID Application: .*/\1/p' | head -n1)}
if [ "${MUXEN_RELEASE:-}" = 1 ]; then
sign_flags="--options runtime --timestamp"
else
diff --git a/scripts/bundle-macos.sh b/scripts/bundle-macos.sh
index fc9b1a4..e987984 100755
--- a/scripts/bundle-macos.sh
+++ b/scripts/bundle-macos.sh
@@ -79,7 +79,9 @@ PLIST
# keeps its Keychain items (cloud sign-ins) and permissions. Not --deep: the
# agents inside are already signed with their own identifier, which the
# permissions on the user's Macs (Screen Recording, Accessibility) belong to.
-identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -n1)}
+# By fingerprint: a keychain can hold several certificates of the same name,
+# and codesign refuses an ambiguous one.
+identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/^ *[0-9][0-9]*) \([0-9A-F]\{40\}\) "Developer ID Application: .*/\1/p' | head -n1)}
if [ -n "$release" ]; then
[ -n "$identity" ] || { echo "error: a release needs a Developer ID Application certificate in the keychain" >&2; exit 1; }
codesign --force --options runtime --timestamp --identifier com.lumarylabs.muxen -s "$identity" "$app"
diff --git a/scripts/notarize-macos.sh b/scripts/notarize-macos.sh
index 6c572fe..0573595 100755
--- a/scripts/notarize-macos.sh
+++ b/scripts/notarize-macos.sh
@@ -78,7 +78,8 @@ ln -s /Applications "$work/dmg/Applications"
rm -f "$dmg"
hdiutil create -quiet -volname "Muxin $version" -srcfolder "$work/dmg" -fs HFS+ -format UDZO "$dmg"
if [ -n "$notarize" ]; then
- identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -n1)}
+ # By fingerprint: a keychain can hold several certificates of the same name.
+ identity=${MUXEN_SIGN_IDENTITY:-$(security find-identity -v -p codesigning 2>/dev/null | sed -n 's/^ *[0-9][0-9]*) \([0-9A-F]\{40\}\) "Developer ID Application: .*/\1/p' | head -n1)}
codesign --force --timestamp -s "$identity" "$dmg"
notarize "$dmg" "$@"
staple "$dmg"