Skip to content

Instantly share code, notes, and snippets.

@umi-uyura
Created September 29, 2015 06:38
Show Gist options
  • Save umi-uyura/b9787cd74493c69a8f20 to your computer and use it in GitHub Desktop.
Save umi-uyura/b9787cd74493c69a8f20 to your computer and use it in GitHub Desktop.
List of iOS Provisioning Profile
#!/bin/sh
TMP_DIR="ProvisioningPlists"
PROVISIONING_PROFILE_LIST=$(find ~/Library/MobileDevice/Provisioning\ Profiles/ -name "*.mobileprovision")
IFS='
'
profile_list=($PROVISIONING_PROFILE_LIST)
rm -rf /tmp/${TMP_DIR}/
if [ ! -d /tmp/${TMP_DIR} ]; then
mkdir "/tmp/${TMP_DIR}"
fi
profiles=()
for i in "${profile_list[@]}"
do
PROVISION_NAME=$(basename ${i} ".mobileprovision")
PLIST_NAME="$PROVISION_NAME.plist"
security cms -D -i ${i} > /tmp/${TMP_DIR}/${PLIST_NAME}
name=$(/usr/libexec/PlistBuddy -c "Print Name" /tmp/${TMP_DIR}/${PLIST_NAME} | sed "s/iOSTeam Provisioning Profile:/TPP:/g")
teamname=$(/usr/libexec/PlistBuddy -c "Print TeamName" /tmp/${TMP_DIR}/${PLIST_NAME} 2> /dev/null)
if [ "$teamname" = "" ]; then
teamname="<NO TEAM>"
fi
profile="$PROVISION_NAME,$teamname,$name"
profiles+=("$profile\n")
done
rm -rf /tmp/${TMP_DIR}/
array=$(echo ${profiles[@]} | sort -t , -k 2,2 -k 3,3 -b)
for p in ${array[@]}
do
# echo $p
provisioning=$(echo $p | cut -d , -f1 | tr -d " " | tr "[:lower:]" "[:upper:]")
teamname2=$(echo $p | cut -d , -f2)
name2=$(echo $p | cut -d , -f3)
echo "${provisioning} (${teamname2} - ${name2})"
done
@umi-uyura
Copy link
Author

TODO:

  • テンポラリファイルにmktempを使ってみる
  • プロビジョニングプロファイルディレクトリを開く

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment