Skip to content

Instantly share code, notes, and snippets.

@dnicolson
Last active February 24, 2019 23:26
Show Gist options
  • Save dnicolson/b71ce1ebb25f2381ea71c9482e98890a to your computer and use it in GitHub Desktop.
Save dnicolson/b71ce1ebb25f2381ea71c9482e98890a to your computer and use it in GitHub Desktop.
After generating a new provisioning profile, this will re-sign and deploy the old YouTube app to an Apple TV
#!/bin/bash
# npm install -g applesign ios-deploy
APPLE_TV=xxx
YOUTUBE_IPA="YouTube 1.2.1.ipa"
provision() {
cd ~/Library/MobileDevice/Provisioning\ Profiles
for provision in *.mobileprovision; do
APP_ID=`/usr/libexec/PlistBuddy -c 'Print :Entitlements:application-identifier' /dev/stdin <<< $(security cms -D -i $provision)`
if [[ $APP_ID == *YouTube ]] ;
then
echo $provision
exit
fi
done
}
$PROVISION = provision
# Re-sign
mkdir /tmp/YouTube
cp "$YOUTUBE_IPA" "/tmp/YouTube/YouTube 1.2.1.ipa"
applesign -r -m "$PROVISION" "/tmp/YouTube/YouTube 1.2.1.ipa"
# Deploy
unzip "/tmp/YouTube/YouTube 1.2.1.ipa" -d /tmp/YouTube
ios-deploy --debug --bundle /tmp/YouTube/Payload/YouTubeTV.app --id $APPLE_TV
rm -rf "/tmp/YouTube"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment