|
2 | 2 |
|
3 | 3 | # Utility script to sign MacVim with a valid Developer ID with hardened runtime |
4 | 4 | # along with a provided entitlments file. This script requires a Developer ID |
5 | | -# cert already installed on the computer. |
| 5 | +# cert already installed on the computer, unless only making adhoc signatures. |
6 | 6 |
|
7 | 7 | # Use the following to verify: |
8 | 8 | # codesign -d --verbose=4 --entitlements - <MacVim_app> |
9 | 9 |
|
10 | 10 | if [[ $# == 0 || $# == 1 ]]; then |
11 | | - echo "Usage: sign-developer-id <MacVim_app> <entitlements_file>" |
| 11 | + echo "Usage: sign-developer-id [--adhoc] <MacVim_app> <entitlements_file>" |
12 | 12 | exit -1 |
13 | 13 | fi |
14 | 14 |
|
15 | 15 | set -e |
16 | 16 |
|
| 17 | +signature_identity="Developer ID Application" |
| 18 | + |
| 19 | +if [[ "$1" == "--adhoc" ]]; then |
| 20 | + # Create an adhoc signature. This is useful for local testing, but cannot |
| 21 | + # generate a valid signed app that you could distribute to other people. |
| 22 | + signature_identity="-" |
| 23 | + shift |
| 24 | +fi |
| 25 | + |
17 | 26 | macvim_path=$1 |
18 | 27 | entitlements=$2 |
19 | 28 |
|
20 | 29 | if [[ "$macvim_path" =~ dmg ]]; then |
21 | 30 | set -x |
22 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp "$macvim_path" |
| 31 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path" |
23 | 32 | else |
24 | 33 | # Sign bottom-up to make sure everything is signed in order. |
25 | 34 | # Note: Not using --deep because it's been deprecated since macOS 13, and |
26 | 35 | # also it doesn't catch all the binaries anyway so it's better to just be |
27 | 36 | # explicit and sign everything in order to be clear what we are doing. |
28 | 37 | if [ -d "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/A" ]; then |
29 | 38 | (set -x |
30 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/fileop" |
31 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app") |
| 39 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app/Contents/MacOS/fileop" |
| 40 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/A/Resources/Autoupdate.app") |
32 | 41 | fi |
33 | 42 | if [ -d $macvim_path/Contents/Frameworks/Sparkle.framework/Versions/B ]; then |
34 | 43 | (set -x |
35 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/B/Autoupdate" |
36 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/B/Updater.app") |
| 44 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/B/Autoupdate" |
| 45 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/B/Updater.app") |
37 | 46 | fi |
38 | 47 | if [ -d $macvim_path/Contents/Frameworks/Sparkle.framework ]; then |
39 | 48 | (set -x |
40 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework") |
| 49 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path/Contents/Frameworks/Sparkle.framework") |
41 | 50 | fi |
42 | 51 | set -x |
43 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp "$macvim_path/Contents/Library/QuickLook/QLStephen.qlgenerator/Contents/MacOS/QLStephen" |
44 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp --entitlements $entitlements "$macvim_path/Contents/bin/xxd" |
45 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp --entitlements $entitlements "$macvim_path/Contents/MacOS/Vim" |
46 | | - codesign -f -s "Developer ID Application" -o runtime --timestamp --entitlements $entitlements "$macvim_path" |
| 52 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path/Contents/Library/QuickLook/QLStephen.qlgenerator/Contents/MacOS/QLStephen" |
| 53 | + codesign -f -s "$signature_identity" -o runtime --timestamp "$macvim_path/Contents/bin/xxd" |
| 54 | + codesign -f -s "$signature_identity" -o runtime --timestamp --entitlements $entitlements "$macvim_path/Contents/MacOS/Vim" |
| 55 | + codesign -f -s "$signature_identity" -o runtime --timestamp --entitlements $entitlements "$macvim_path" |
47 | 56 | fi |
0 commit comments