Created
August 25, 2014 18:28
find the team identifier and team name for a given distribution provisioning profile
This file contains hidden or 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
#!/bin/sh | |
# find the team identifier and team name for a given distribution provisioning profile | |
function provisioning_identity() { | |
ORIGINAL_PROVISION="$1" | |
security cms -D -i $ORIGINAL_PROVISION > "tmp.plist" | |
TMP_FILE="tmp.plist" | |
local result=() | |
for var in TeamIdentifier TeamName ; do | |
val=$( /usr/libexec/PlistBuddy -c "Print $var" "$TMP_FILE" ) | |
declare -x $var="$val" | |
for name in ${val[@]} ; do | |
if [[ "${name}" != "{" && "${name}" != "}" && "${name}" != "Array" ]] ; then | |
result+=("${name}") | |
fi | |
done | |
done | |
echo ${result[@]} | |
#rm tmp.plist | |
} | |
#mp contains your provisioning profile path | |
mp=$1 | |
provisioningarray=$(provisioning_identity ${mp}) | |
result=() | |
for i in ${provisioningarray[@]} ; do | |
result+=("${i}") | |
done | |
for (( i = 1; i < ${#result[@]}; i++ )); do | |
echo "${result[i]}" | |
TEAM_NAME+="${result[i]} " | |
done | |
TEAM_IDENTIFIER="${result[0]}" | |
echo $TEAM_IDENTIFIER | |
echo $TEAM_NAME | |
identity="iPhone Distribution: $TEAM_NAME($TEAM_IDENTIFIER)" | |
echo $identity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment