-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile for unpacking and repacking apk
- Loading branch information
0 parents
commit 5410551
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apk.out/ | ||
dist/ | ||
dll/ | ||
|
||
original.apk | ||
|
||
debug-cert.pem | ||
debug-key.pk8 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
12dc636b2d9e2f6a75d28fc15a3d98ef6ec43f3f95a8710b8aba1ceae29efccd original.apk |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
all: dist/signed.apk | ||
|
||
.PHONY: all clean install unpack | ||
|
||
APK_DIR=apk.out/ | ||
MAIN_DLL=${APK_DIR}assets/bin/Data/Managed/Assembly-CSharp.dll | ||
|
||
${APK_DIR}: original.apk | ||
sha256sum -c CHECKSUMS.sha256 | ||
apktool decode --output ${APK_DIR} $< | ||
mkdir -p dll/original/ | ||
mv ${MAIN_DLL} dll/original/ | ||
|
||
install: dist/signed.apk | ||
adb install $< | ||
|
||
clean: | ||
rm -rf dist/ dll/ ${APK_DIR} | ||
|
||
dist/base.apk: ${APK_DIR} ${MAIN_DLL} | ||
mkdir -p dist/ | ||
apktool build --output $@ ${APK_DIR} | ||
|
||
dist/aligned.apk: dist/base.apk | ||
rm -f $@ | ||
zipalign 4 $< $@ | ||
|
||
dist/signed.apk: dist/aligned.apk debug-key.pk8 | ||
apksigner sign --key debug-key.pk8 --cert debug-cert.pem --out $@ dist/aligned.apk | ||
|
||
debug-key.pk8: | ||
openssl req -x509 -days 9125 -newkey rsa:1024 -nodes -keyout debug-key.pem -out debug-cert.pem -subj "/CN=debug" | ||
openssl pkcs8 -topk8 -outform DER -in debug-key.pem -inform PEM -out debug-key.pk8 -nocrypt | ||
rm debug-key.pem | ||
|
||
dll/main.il: dll/original/Assembly-CSharp.dll | ||
ildasm -out=$@ $< | ||
|
||
${MAIN_DLL}: dll/main.il | ||
ilasm -dll -output=$@ $< |