-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💚 Check that codesigning certificate was successfully imported
- Loading branch information
Showing
2 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
#!/bin/bash | ||
echo "Creating new keychain" | ||
|
||
security create-keychain -p "$MAC_CERTS_PASSWORD" build.keychain | ||
security create-keychain -p "$MAC_KEY_PASSWORD" build.keychain | ||
security default-keychain -s build.keychain | ||
security unlock-keychain -p "$MAC_CERTS_PASSWORD" build.keychain | ||
security unlock-keychain -p "$MAC_KEY_PASSWORD" build.keychain | ||
|
||
echo "Importing key" | ||
security import <(echo $MAC_KEY | base64 -d) -P "$MAC_CERTS_PASSWORD" -f pkcs12 | ||
security import <(echo $MAC_KEY | base64 -d) -P "$MAC_KEY_PASSWORD" -f pkcs12 | ||
|
||
echo "Trusting Certificate" | ||
# Using sudo because overwriting trust settings would require interactive password input | ||
echo $MAC_CERT | base64 -d > cert.cer | ||
sudo security authorizationdb write com.apple.trust-settings.admin allow | ||
sudo security add-trusted-cert -d -r trustRoot -p codeSign -k build.keychain cert.cer | ||
sudo security authorizationdb remove com.apple.trust-settings.admin | ||
|
||
n_valid_certs=`security find-identity -v -p codesigning | grep 'valid identities found' | awk '{ print $1 }'` | ||
|
||
if [ $n_valid_certs -lt 1 ]; then | ||
echo "Error, no valid codesigning certificate found" | ||
security find-identity -p codesigning | ||
exit 1 | ||
fi |