Skip to content

Commit 3dcae36

Browse files
Add injecting to an .ipa in inject.sh
Now running `inject.sh` adds the original files into `iloveusomuch.ipa`, and running `inject.sh project` puts them into the project folder.
1 parent 5aa4d55 commit 3dcae36

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

inject.sh

100644100755
Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#!/bin/sh
22

3-
OUT_DIR="./iloveusomuch/originalAssets"
3+
###
4+
### Injects assets from the original app into an .ipa or the project itself
5+
###
46

5-
IPA_NAME="original.ipa"
7+
ORIGINAL_IPA_NAME="original.ipa"
8+
IPA_NAME="iloveusomuch.ipa"
9+
10+
if [ "$1" == "project" ]; then
11+
OUT_DIR="./iloveusomuch/originalAssets"
12+
else
13+
OUT_DIR="./Payload/iloveusomuch.app"
14+
mkdir -p $OUT_DIR
15+
fi
616

717
zipPath="Payload/Cassius.app/"
818
zipFiles=(
@@ -12,13 +22,13 @@ zipFiles=(
1222
"${zipPath}Videos.m4v"
1323
)
1424

15-
if ! [ -f "./original.ipa" ]; then
16-
echo "Please put the original .ipa file under the 'original.ipa' name first"
25+
if ! [ -f "./$ORIGINAL_IPA_NAME" ]; then
26+
echo "Please put the original .ipa file under the '$ORIGINAL_IPA_NAME' name first"
1727
exit 1
1828
fi
1929

2030
# Check if the required files are in place
21-
givenZipFileList=`unzip -Z1 $IPA_NAME`
31+
givenZipFileList=`unzip -Z1 $ORIGINAL_IPA_NAME`
2232
for file in ${zipFiles[@]}; do
2333
if ! echo "$givenZipFileList" | grep $file >> /dev/null; then
2434
echo "'$file' not found. Are you sure that you're using the correct .ipa file?"
@@ -32,7 +42,7 @@ for file in ${zipFiles[@]}; do
3242
zipFilesArg="${zipFilesArg} ${file}"
3343
done
3444

35-
unzip -j $IPA_NAME ${zipFilesArg} -d $OUT_DIR
45+
unzip -j $ORIGINAL_IPA_NAME ${zipFilesArg} -d $OUT_DIR
3646

3747
if ! [ $? = 0 ]; then
3848
echo "Failed to uncompress the archive"
@@ -43,3 +53,15 @@ mv $OUT_DIR/[email protected] $OUT_DIR/loader.png
4353

4454
# Download the original app icon from web.archive.org
4555
curl -o $OUT_DIR/AppIcon.png "https://web.archive.org/web/20240111215624if_/https://is4-ssl.mzstatic.com/image/thumb/Purple/2b/df/56/mzi.rptjtlhi.png/738x0w.png"
56+
if ! [ $? = 0 ]; then
57+
echo "Failed to download an app icon"
58+
exit 1
59+
fi;
60+
61+
if [ "$1" == "project" ]; then
62+
exit 0;
63+
fi
64+
65+
# Inject files into a compiled .ipa
66+
zip -ru $IPA_NAME Payload
67+
rm -R ./Payload

0 commit comments

Comments
 (0)