Skip to content

Instantly share code, notes, and snippets.

@slabko
Last active August 29, 2015 14:10
Show Gist options
  • Save slabko/ed5ab9bc5bd5485cf022 to your computer and use it in GitHub Desktop.
Save slabko/ed5ab9bc5bd5485cf022 to your computer and use it in GitHub Desktop.
[Build] Check if there is more that one provisioning profile with the given name
#!/bin/bash
PROFILE_NAME='iOSTeam Provisioning Profile: Andrew Slabko'
ARRAY=()
DIR="/Users/slabko/Library/MobileDevice/Provisioning Profiles"
for f in "$DIR"/*.mobileprovision
do
NAME=`security cms -D -i "$f" > tmp.plist && /usr/libexec/PlistBuddy -c 'Print :Name' tmp.plist`
if [ "$NAME" = "$PROFILE_NAME" ]; then
echo "$f created `security cms -D -i "$f" > tmp.plist && /usr/libexec/PlistBuddy -c 'Print :CreationDate' tmp.plist`"
ARRAY+=("$f")
fi
done
if [ ${#ARRAY[@]} -gt 1 ]; then
echo "Found more than one profile"
exit 0
fi
if [ ${#ARRAY[@]} -eq 0 ]; then
echo "No profiles found with the name $PROFILE_NAME"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment