forked from Tracktion/pluginval
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmac_install_certificate
More file actions
executable file
·38 lines (30 loc) · 1.02 KB
/
mac_install_certificate
File metadata and controls
executable file
·38 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash -e
CERT_BASE64_STRING=$1
CERT_FILE_NAME=$2
if [ -z "$CERT_BASE64_STRING" ]; then
echo "CERT_BASE64_STRING needed as first arg!"
exit 1
fi
if [ -z "$CERT_FILE_NAME" ]; then
echo "CERT_FILE_NAME needed as second arg!"
exit 1
fi
#========================================================================
# Create the cert file from the base 64 string arg
CERT_BASE64_FILE="/tmp/$CERT_FILE_NAME"
rm "$CERT_BASE64_FILE"
touch "$CERT_BASE64_FILE"
echo "$CERT_BASE64_STRING" > "$CERT_BASE64_FILE"
#========================================================================
# Make sure the cert file is cleaned up on exit
function cleanup
{
echo "Removing CERT_BASE64_FILE: $CERT_BASE64_FILE"
rm "$CERT_BASE64_FILE"
}
trap cleanup EXIT
#========================================================================
# Create a file from the base 64 file
openssl base64 -d -in "$CERT_BASE64_FILE" -out "$CERT_FILE_PATH"
# Then import it in to the login keychain
security import "$CERT_FILE_PATH" -k ~/Library/Keychains/login.keychain