Forked from benvium/installMobileProvisionFile.sh
Last active
August 29, 2015 14:01
-
-
Save fejese/74624638924e987b9c8e 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 | |
# 2012 - Ben Clayton (benvium). Calvium Ltd | |
# Found at https://gist.github.com/2568707 | |
# | |
# This script installs a .mobileprovision file without using Xcode. Unlike Xcode, it'll | |
# work over SSH. | |
# | |
# Requires Mac OS X (I'm using 10.7 and Xcode 4.3.2) | |
# | |
# For the first time it will install mobileprovision-read executable by downloading and | |
# compiling it using curl and gcc. | |
# See https://www.github.com/0xc010d/mobileprovision-read and | |
# http://idevblog.info/mobileprovision-files-structure-and-reading | |
# | |
# Usage installMobileProvisionFile.sh path/to/foobar.mobileprovision | |
MOBILEPROVISION_READ_BIN=${BASH_SOURCE[0]%/*}/mobileprovision-read | |
if [ ! $# == 1 ]; then | |
echo "Usage: $0 (path/to/mobileprovision)" | |
exit 1 | |
fi | |
if ! [ -f ${MOBILEPROVISION_READ_BIN} ]; then | |
curl https://raw.githubusercontent.com/0xc010d/mobileprovision-read/master/main.m \ | |
| gcc -framework Foundation -framework Security -o ${MOBILEPROVISION_READ_BIN} -x objective-c - | |
fi | |
if ! [ -x "${MOBILE_PROVISION_READ_BIN}" ]; then | |
echo "Mobile provision profile reader is not valid [${MOBILE_PROVISION_READ_BIN}]" | |
exit 2 | |
fi | |
H="[0-9A-F]" | |
if ! [[ "${uuid}" =~ ^$H{8}-$H{4}-$H{4}-$H{4}-$H{12}$ ]]; then | |
echo "Invalid UUID found [${uuid}]" | |
exit 3 | |
fi | |
mp=$1 | |
uuid=`${MOBILEPROVISION_READ_BIN} -f ${mp} -o UUID` | |
echo "Found UUID $uuid" | |
output=~/"Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision" | |
echo "copying to $output.." | |
cp "${mp}" "$output" | |
echo "done" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment