GingerCal 1.1: apksigner v1 signing so Android 2.3 installs it; add Pangolin VPS setup notes
This commit is contained in:
1 parent
01f49852ab
commit
f44ecf4871
10 files changed
+267
-246
No files matched your search
+9
-5
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Minimal zipalign: stored entries start on 4-byte boundaries. Keeps v1 (JAR) signatures valid,
|
||||
since those cover file contents, not the zip layout. usage: zipalign.py in.apk out.apk"""
|
||||
"""Minimal zipalign: uncompressed entries start on 4-byte boundaries (like the SDK's
|
||||
`zipalign 4`). Safe after v1 (JAR) signing, which covers entry contents, not zip layout.
|
||||
usage: zipalign.py in.apk out.apk"""
|
||||
import struct
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
@@ -16,9 +18,11 @@ with zipfile.ZipFile(src) as zin, open(dst, "wb") as f:
|
||||
header_end = f.tell() + 30 + len(info.filename.encode("utf-8"))
|
||||
out.extra = b"\0" * ((4 - header_end % 4) % 4)
|
||||
zout.writestr(out, data)
|
||||
with zipfile.ZipFile(dst) as z:
|
||||
|
||||
with open(dst, "rb") as raw, zipfile.ZipFile(dst) as z:
|
||||
for info in z.infolist():
|
||||
if info.compress_type == zipfile.ZIP_STORED:
|
||||
start = info.header_offset + 30 + len(info.filename.encode("utf-8")) + len(info.extra)
|
||||
assert start % 4 == 0, info.filename
|
||||
raw.seek(info.header_offset + 26)
|
||||
n, m = struct.unpack("<HH", raw.read(4))
|
||||
assert (info.header_offset + 30 + n + m) % 4 == 0, info.filename
|
||||
print("aligned", dst)
|
||||
Reference in new issue
Block a user