Last active
November 19, 2015 22:13
-
-
Save olegoid/01b1ff0bce3b6eacfb48 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 | |
IPA=$1 | |
DIR=$(dirname "${IPA}") | |
TEMPDIR=${DIR}/tmp | |
BACKUP=${IPA}_backup | |
EXTENSION="${IPA##*.}" | |
# Verify user input | |
if [ "$IPA" == "" ]; then | |
echo "Provide path to *.ipa file" | |
exit 0 | |
elif [[ -d $IPA ]]; then | |
echo "Provided path is invalid" | |
exit 0 | |
elif [[ $EXTENSION != "ipa" ]]; then | |
echo "Provided file is not *.ipa" | |
exit 0 | |
fi | |
# Create *.ipa backup | |
mkdir $BACKUP | |
cp $IPA $BACKUP | |
# Change *.ipa extension to *.zip | |
mv -v $IPA ${IPA%.ipa}.zip | |
# Create temporary directory | |
mkdir $TEMPDIR | |
# Unzip file to tmp directory | |
unzip ${IPA%.ipa} -d $TEMPDIR | |
# Remove zip archive | |
rm ${IPA%.ipa}.zip | |
# Compress Payload folder | |
PAYLOAD=$TEMPDIR/'Payload' | |
zip -r $PAYLOAD.zip $PAYLOAD | |
# Rename Payload zip | |
mv -v $PAYLOAD.zip $IPA | |
rm -rf $PAYLOAD | |
# Move ipa file from tmp folder | |
mv $PAYLOAD $DIR | |
# Delete tmp directory | |
rm -rf $TEMPDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment