Last active
August 29, 2015 13:58
-
-
Save sergii-frost/10190609 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/bash | |
### Function to get UUID from .mobileprovision file | |
### $1 - .mobileprovision file to get UUID for | |
function get_uuid() { | |
uuid=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i "$1")` | |
echo $uuid | |
} | |
### Go through all provisioning profiles and just echo their uuids | |
### $1 - Source directory | |
### $2 - Destination directory | |
function copy_profiles() { | |
mkdir -p $2 | |
for file in $1/*.mobileprovision | |
do | |
if [ -f $file ] | |
then | |
uuid=`get_uuid $file` | |
uuid_file_path="$2/$uuid.mobileprovision" | |
printf "Copy %s \t\t--> %s\n" "$file" "$uuid_file_path" | |
cp -f "$file" "$uuid_file_path" | |
else | |
printf "File(s) not found: %s\n" "$file" | |
fi | |
done | |
} | |
### $1 - Source directory with .mobileprovision files | |
### $2 - Destination directory to copy profiles with UUIDs as names to. | |
main() { | |
if (( $# != 2 )) | |
then | |
printf "Usage: %s SRC DEST \n" $0 | |
printf "Where\t SRC - folder with provisioning profiles to copy \n" | |
printf "Where\t DEST - folder to copy renamed profiles to\n" | |
else | |
copy_profiles $1 $2 | |
fi | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment