mirror of
https://github.com/YTVanced/Vanced
synced 2024-12-22 08:20:10 +00:00
Add bsdiff generation tools
This commit is contained in:
parent
c3eb71d6e3
commit
c50b8fe736
3 changed files with 40 additions and 0 deletions
|
@ -70,3 +70,10 @@ ___
|
|||
- [gghhkm](https://github.com/gghhkm)
|
||||
- [Vendicated](https://github.com/Vendicated)
|
||||
- [Milind Goel](https://github.com/milindgoel15)
|
||||
|
||||
___
|
||||
|
||||
## BSDiff Tools
|
||||
|
||||
- To use these you must have a copy of a v1 vanced api "apks" folder of the version you want make diffs of and run the python script from there
|
||||
- Before you run the script move the root/Theme stock and dpi apk to your working directory, delete the hash.json file and run the "generate_base_apk.sh" script to make a compatible base apk
|
18
apk2bsdiff.py
Normal file
18
apk2bsdiff.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import bsdiff4
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
for path in Path('./nonroot/Arch').rglob('*.apk'):
|
||||
bsdiff4.file_diff(str(path).replace('nonroot', 'root'), path, './patches/Arch/' + path.name.replace('.apk','.bsdiff'))
|
||||
|
||||
for path in Path('./nonroot/Language').rglob('*.apk'):
|
||||
bsdiff4.file_diff(str(path).replace('nonroot', 'root'), path, './patches/Language/' + path.name.replace('.apk','.bsdiff'))
|
||||
|
||||
for path in Path('./nonroot/Theme').rglob('*.apk'):
|
||||
bsdiff4.file_diff('base.apk', path, './patches/Theme/' + path.name.replace('.apk','.bsdiff'))
|
||||
|
||||
for path in Path('./root/Theme').rglob('*.apk'):
|
||||
bsdiff4.file_diff('base.apk', path, './patches/root/' + path.name.replace('.apk','.bsdiff'))
|
||||
|
||||
for path in Path('./patches').rglob('*.bsdiff'):
|
||||
shutil.copy(path, './patches/' + str(path).replace('/', '-')[8:])
|
15
base_apk_generator.sh
Normal file
15
base_apk_generator.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
echo 'Extracting apks...'
|
||||
mv stock.apk base.apk
|
||||
unzip base.apk resources.arsc
|
||||
unzip dpi.apk -d dpi
|
||||
echo 'combining resources...'
|
||||
cd dpi
|
||||
touch -a -m -t 198101010101.01 .
|
||||
touch -a -m -t 198101010101.01 ./res
|
||||
touch -a -m -t 198101010101.01 ./res/*
|
||||
zip -0X ../base.apk ./res/*
|
||||
zip -X ../base.apk ./res/*.xml
|
||||
cd ..
|
||||
cat ./dpi/resources.arsc >> ./resources.arsc
|
||||
touch -a -m -t 198101010101.01 resources.arsc
|
||||
zip -0X base.apk ./resources.arsc
|
Loading…
Reference in a new issue