|
| 1 | +#!/bin/bash |
| 2 | +# Invoke this script with a relative '.app' path, for example: |
| 3 | +# codesign-electron.sh "darwin-x64/Electron.app" |
| 4 | + |
| 5 | +# 1. Run the following command to get a list of identities: |
| 6 | +# security find-identity |
| 7 | + |
| 8 | +# 2. Now set the value of the identity variable below to the identity you want to use: |
| 9 | +identity=$REACTOTRON_CODESIDE_IDENTITY |
| 10 | + |
| 11 | +app="$PWD/$1" |
| 12 | + |
| 13 | +echo "Signing..." |
| 14 | +# When you sign frameworks, you have to sign a specific version. |
| 15 | +# For example, you have to sign "Electron Framework.framework/Versions/A" |
| 16 | +# Signing the top level folder ("Electron Framework.framework") will fail. |
| 17 | +# Signing "Electron Framework.framework/Versions/Current" will also fail (because it is a symbolic link). |
| 18 | +# Apple recommends NOT using --deep, but rather signing each item explictly (which is how XCode does it). |
| 19 | +# Other scripts sometimes resign items multiple times in the process because of --deep which is slow. |
| 20 | +# The following signs the bare minimum needed to get Gatekeeper acceptance. |
| 21 | +# If you renamed "Electron Helper.app", "Electron Helper EH.app" and "Electron Helper NP.app" then rename below. |
| 22 | +codesign --verbose --sign "$identity" "$app/Contents/Frameworks/Electron Framework.framework/Versions/A" |
| 23 | +codesign --verbose --sign "$identity" "$app/Contents/Frameworks/Reactotron Helper EH.app" |
| 24 | +codesign --verbose --sign "$identity" "$app/Contents/Frameworks/Reactotron Helper NP.app" |
| 25 | +codesign --verbose --sign "$identity" "$app/Contents/Frameworks/Reactotron Helper.app" |
| 26 | +codesign --verbose --sign "$identity" "$app/Contents/Frameworks/Mantle.framework/Versions/A" |
| 27 | +codesign --verbose --sign "$identity" "$app/Contents/Frameworks/ReactiveCocoa.framework/Versions/A" |
| 28 | +codesign --verbose --sign "$identity" "$app/Contents/Frameworks/Squirrel.framework/Versions/A" |
| 29 | +codesign --verbose --sign "$identity" "$app" |
| 30 | + |
| 31 | +# This will often pass, even if Gatekeeper fails. |
| 32 | +echo "" |
| 33 | +echo "Verifying signatures..." |
| 34 | +codesign --verify --deep --display --verbose=4 "$app" |
| 35 | + |
| 36 | +# This is what really counts and what the user will see. |
| 37 | +echo "" |
| 38 | +echo "Veriyfing Gatekeeper acceptance..." |
| 39 | +spctl --ignore-cache --no-cache --assess --type execute --verbose=4 "$app" |
0 commit comments