Forked from djromero/update_provisioning_profile.sh
Last active
August 29, 2015 14:07
-
-
Save pcuenca/1b5027210690cb650c43 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# | |
# Download and install iOS provisioning profiles | |
# Requires https://github.com/nomad/cupertino | |
# | |
# Usage | |
# - Login to your account once: | |
# ios login | |
# - Configure TEAM and PROFILE (instructions below) | |
# - Run update_provisioning_profile.sh at anytime, usually after adding/removing devices to the profile | |
# Configure the team identifier | |
# Copy it from developer portal or just use cupertino to get it: | |
# ios devices | |
# Copy the string in parens and set it as TEAM | |
TEAM="team id" | |
# Configure the profile names you want to manage | |
# Copy them from developer portal or use cupertino to get a list (ignoring Xcode managed profiles): | |
# ios profiles --team ${TEAM} | grep -v 'iOS Team Provisioning Profile' | |
# Copy the desired profile names into the PROFILES array | |
PROFILES=( "Profile One" "Profile Two" "Profile Three" ) | |
num_profiles=${#PROFILES[*]} | |
typeset -i profile_idx=0 | |
while [[ $profile_idx -lt $num_profiles ]] | |
do | |
profile=${PROFILES[$profile_idx]} | |
let profile_idx=$profile_idx+1 | |
# Fetch the profile using `cupertino` tool | |
# you need to run `ios login` once to setup the account | |
ios profiles:download "${profile}" --team ${TEAM} | |
PROFILE_FILE=`echo $profile | tr ' ' '_'` # `cupertino` tool will replace spaces with _ | |
UUID=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i ${PROFILE_FILE}.mobileprovision)` | |
# copy where Xcode can find it | |
cp ${PROFILE_FILE}.mobileprovision "$HOME/Library/MobileDevice/Provisioning Profiles/${UUID}.mobileprovision" | |
# clean | |
rm ${PROFILE_FILE}.mobileprovision | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment