From 36a5a4cebd5cc158149306b5001f75e567c803c8 Mon Sep 17 00:00:00 2001 From: Rikka Date: Fri, 1 Nov 2024 23:29:15 +0800 Subject: [PATCH] Add md5sum verification for litegapps --- .gitignore | 1 + README.md | 6 + redroid.py | 10 +- {stuffs => stuff}/gapps.py | 6 +- {stuffs => stuff}/general.py | 2 +- {stuffs => stuff}/houdini.py | 2 +- stuff/litegapps.py | 215 ++++++++++++++++++++++++++++++++++ {stuffs => stuff}/magisk.py | 10 +- {stuffs => stuff}/ndk.py | 2 +- {stuffs => stuff}/widevine.py | 6 +- stuffs/litegapps.py | 49 -------- tools/helper.py | 6 +- 12 files changed, 247 insertions(+), 68 deletions(-) rename {stuffs => stuff}/gapps.py (90%) rename {stuffs => stuff}/general.py (90%) rename {stuffs => stuff}/houdini.py (98%) create mode 100644 stuff/litegapps.py rename {stuffs => stuff}/magisk.py (93%) rename {stuffs => stuff}/ndk.py (98%) rename {stuffs => stuff}/widevine.py (97%) delete mode 100644 stuffs/litegapps.py diff --git a/.gitignore b/.gitignore index 7e5f333..c02a3f5 100644 --- a/.gitignore +++ b/.gitignore @@ -109,4 +109,5 @@ magisk ndk widevine houdini +litegapps Dockerfile \ No newline at end of file diff --git a/README.md b/README.md index 6a744a8..0fd7ef6 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,12 @@ python redroid.py -a 11.0.0 python redroid.py -g ``` +## Add liteGapps to ReDroid image + +```bash +python redroid.py -lg +``` + ## Add libndk arm translation to ReDroid image diff --git a/redroid.py b/redroid.py index 5222738..7769053 100644 --- a/redroid.py +++ b/redroid.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 import argparse -from stuffs.gapps import Gapps -from stuffs.litegapps import LiteGapps -from stuffs.magisk import Magisk -from stuffs.ndk import Ndk -from stuffs.widevine import Widevine +from stuff.gapps import Gapps +from stuff.litegapps import LiteGapps +from stuff.magisk import Magisk +from stuff.ndk import Ndk +from stuff.widevine import Widevine import tools.helper as helper import subprocess diff --git a/stuffs/gapps.py b/stuff/gapps.py similarity index 90% rename from stuffs/gapps.py rename to stuff/gapps.py index b94efa8..1f409a9 100644 --- a/stuffs/gapps.py +++ b/stuff/gapps.py @@ -1,14 +1,14 @@ import os import shutil -from stuffs.general import General +from stuff.general import General from tools.helper import get_download_dir, host, print_color, run, bcolors class Gapps(General): dl_links = { "x86_64": ["https://sourceforge.net/projects/opengapps/files/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip", "5a6d242be34ad1acf92899c7732afa1b"], "x86": ["https://sourceforge.net/projects/opengapps/files/x86/20220503/open_gapps-x86-11.0-pico-20220503.zip", "efda4943076016d00b40e0874b12ddd3"], - "arm64-v8a": ["https://sourceforge.net/projects/opengapps/files/arm64/20220503/open_gapps-arm64-11.0-pico-20220503.zip", "67e927e4943757f418e4f934825cf987"], - "armeabi-v7a": ["https://sourceforge.net/projects/opengapps/files/arm/20220215/open_gapps-arm-11.0-pico-20220215.zip", "8719519fa32ae83a62621c6056d32814"] + "arm64": ["https://sourceforge.net/projects/opengapps/files/arm64/20220503/open_gapps-arm64-11.0-pico-20220503.zip", "67e927e4943757f418e4f934825cf987"], + "arm": ["https://sourceforge.net/projects/opengapps/files/arm/20220215/open_gapps-arm-11.0-pico-20220215.zip", "8719519fa32ae83a62621c6056d32814"] } arch = host() download_loc = get_download_dir() diff --git a/stuffs/general.py b/stuff/general.py similarity index 90% rename from stuffs/general.py rename to stuff/general.py index 991c9b3..13395b4 100644 --- a/stuffs/general.py +++ b/stuff/general.py @@ -13,7 +13,7 @@ class General: with open(self.dl_file_name,"rb") as f: bytes = f.read() loc_md5 = hashlib.md5(bytes).hexdigest() - while not os.path.isfile(self.dl_file_name) or (self.act_md5 != "" and loc_md5 != self.act_md5): + while not os.path.isfile(self.dl_file_name) or loc_md5 != self.act_md5: if os.path.isfile(self.dl_file_name): os.remove(self.dl_file_name) print_color("md5 mismatches, redownloading now ....",bcolors.YELLOW) diff --git a/stuffs/houdini.py b/stuff/houdini.py similarity index 98% rename from stuffs/houdini.py rename to stuff/houdini.py index 4783017..febe966 100644 --- a/stuffs/houdini.py +++ b/stuff/houdini.py @@ -1,7 +1,7 @@ import os import re import shutil -from stuffs.general import General +from stuff.general import General from tools.helper import bcolors, get_download_dir, print_color, run diff --git a/stuff/litegapps.py b/stuff/litegapps.py new file mode 100644 index 0000000..f590420 --- /dev/null +++ b/stuff/litegapps.py @@ -0,0 +1,215 @@ +import os +import shutil +from stuff.general import General +from tools.helper import get_download_dir, host, print_color, run, bcolors + + +class LiteGapps(General): + dl_links = { + "15.0.0": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/35/lite/2024-10-27/LiteGapps-x86_64-15.0-20241027-official.zip", + "ff6d94d6a0344320644b66fa9f662eda", + ], + "x86": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86/35/lite/2024-10-27/LiteGapps-x86-15.0-20241027-official.zip", + "9fcc749616bf362d5152c94ec73c2534", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/35/lite/2024-10-23/LiteGapps-arm64-15.0-20241023-official.zip", + "fdf6ab112e1cb1125b5b926669e40e6d", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/35/lite/2024-10-26/LiteGapps-arm-15.0-20241026-official.zip", + "4b08efae685ddd4846acfffc40dd0062", + ], + }, + "15.0.0_64only": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/35/lite/2024-10-27/LiteGapps-x86_64-15.0-20241027-official.zip", + "ff6d94d6a0344320644b66fa9f662eda", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/35/lite/2024-10-23/LiteGapps-arm64-15.0-20241023-official.zip", + "fdf6ab112e1cb1125b5b926669e40e6d", + ], + }, + "14.0.0": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/34/lite/v3.0/AUTO_LiteGapps_x86_64_14.0_v3.0_official.zip", + "51cbdb561f9c9162e4fdcbffe691c4bc", + ], + "x86": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86/35/lite/2024-10-27/LiteGapps-x86-15.0-20241027-official.zip", + "9fcc749616bf362d5152c94ec73c2534", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/34/lite/2024-10-22/LiteGapps-arm64-14.0-20241022-official.zip", + "30be139a5f9c52b78e3f852877ad2f0b", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/34/lite/2024-10-28/LiteGapps-arm-14.0-20241028-official.zip", + "94669d92feec6724bc521ece19754fb0", + ], + }, + "14.0.0_64only": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/34/lite/v3.0/AUTO_LiteGapps_x86_64_14.0_v3.0_official.zip", + "51cbdb561f9c9162e4fdcbffe691c4bc", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/34/lite/2024-10-22/LiteGapps-arm64-14.0-20241022-official.zip", + "30be139a5f9c52b78e3f852877ad2f0b", + ], + }, + "13.0.0": { + "x86_64": [ + "https://master.dl.sourceforge.net/project/litegapps/litegapps/x86_64/33/lite/2024-02-22/AUTO-LiteGapps-x86_64-13.0-20240222-official.zip", + "d91a18a28cc2718c18726a59aedcb8da", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/33/lite/2024-10-22/LiteGapps-arm64-13.0-20241022-official.zip", + "a8b1181291fe70d1e838a8579218a47c", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/33/lite/2024-08-15/AUTO-LiteGapps-arm-13.0-20240815-official.zip", + "5a1d192a42ef97693f63d166dea89849", + ], + }, + "13.0.0__64only": { + "x86_64": [ + "https://master.dl.sourceforge.net/project/litegapps/litegapps/x86_64/33/lite/2024-02-22/AUTO-LiteGapps-x86_64-13.0-20240222-official.zip", + "d91a18a28cc2718c18726a59aedcb8da", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/33/lite/2024-10-22/LiteGapps-arm64-13.0-20241022-official.zip", + "a8b1181291fe70d1e838a8579218a47c", + ], + }, + "12.0.0": { + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/31/lite/2024-10-10/AUTO-LiteGapps-arm64-12.0-20241010-official.zip", + "ed3196b7d6048ef4adca6388a771cd84", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/31/lite/v2.5/%5BAUTO%5DLiteGapps_arm_12.0_v2.5_official.zip", + "35e1f98dd136114fc1ca74e3a0539cfa", + ], + }, + "12.0.0_64only": { + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/31/lite/2024-10-10/AUTO-LiteGapps-arm64-12.0-20241010-official.zip", + "ed3196b7d6048ef4adca6388a771cd84", + ], + }, + "11.0.0": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/30/lite/2024-10-12/AUTO-LiteGapps-x86_64-11.0-20241012-official.zip", + "5c2a6c354b6faa6973dd3f399bbe162d", + ], + "x86": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86/30/lite/2024-10-12/AUTO-LiteGapps-x86-11.0-20241012-official.zip", + "7252ea97a1d66ae420f114bfe7089070", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/30/lite/2024-10-21/LiteGapps-arm64-11.0-20241021-official.zip", + "901fd830fe4968b6979f38169fe49ceb", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/30/lite/2024-08-18/AUTO-LiteGapps-arm-11.0-20240818-official.zip", + "d4b2471d94facc13c9e7a026f2dff80d", + ], + }, + "10.0.0": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/29/lite/v2.6/%5BAUTO%5DLiteGapps_x86_64_10.0_v2.6_official.zip", + "d2d70e3e59149e23bdc8975dd6fa49e1", + ], + "x86": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86/29/lite/v2.6/%5BAUTO%5DLiteGapps_x86_10.0_v2.6_official.zip", + "14e20a4628dc3198bbe79774cb1c33dc", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/29/lite/2024-10-22/LiteGapps-arm64-10.0-20241022-official.zip", + "0d079569cb5e2687939993776abb538c", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/29/lite/2024-08-18/AUTO-LiteGapps-arm-10.0-20240818-official.zip", + "a467f73d2b5a1ff9882d070989db0f0e", + ], + }, + "9.0.0": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/28/lite/v2.6/%5BAUTO%5DLiteGapps_x86_64_9.0_v2.6_official.zip", + "fc17a35518af188015baf1a682eb9fc7", + ], + "x86": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86/28/lite/v2.6/%5BAUTO%5DLiteGapps_x86_9.0_v2.6_official.zip", + "31981cd14199d6b3610064b09d96e278", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/28/lite/2024-02-23/AUTO-LiteGapps-arm64-9.0-20240223-official.zip", + "b8ccfbedbf003803af19346c610988c0", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/28/lite/%5BAUTO%5DLiteGapps_arm_9.0_v2.5_official.zip", + "8034245b695b6b31cd6a5d2ed5b2b670", + ], + }, + "8.1.0": { + "x86_64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86_64/27/lite/v2.6/%5BAUTO%5DLiteGapps_x86_64_8.1_v2.6_official.zip", + "eee0ebdea5eb7580cab9dec307b46f56", + ], + "x86": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/x86/27/lite/v2.6/%5BAUTO%5DLiteGapps_x86_8.1_v2.6_official.zip", + "5739feb54fdf85dc1d870998aeeee43a", + ], + "arm64": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm64/27/lite/2024-02-22/AUTO-LiteGapps-arm64-8.1-20240222-official.zip", + "35d4195595961dc229f617c30c5460bb", + ], + "arm": [ + "https://sourceforge.net/projects/litegapps/files/litegapps/arm/27/lite/%5BAUTO%5DLiteGapps_arm_8.1_v2.5_official.zip", + "b0f7f5ba418b1696005f4e3f5abe924f", + ], + }, + } + api_level_map = { + "15.0.0": "35", + "14.0.0": "34", + "13.0.0": "33", + "12.0.0": "31", + "11.0.0": "30", + "10.0.0": "29", + "9.0.0": "28", + "8.1.0": "27", + } + arch = host() + download_loc = get_download_dir() + dl_file_name = os.path.join(download_loc, "litegapps.zip") + dl_link = ... + act_md5 = ... + copy_dir = "./litegapps" + extract_to = "/tmp/litegapps/extract" + + def __init__(self, version): + self.version = version + self.dl_link = self.dl_links[self.version][self.arch[0]][0] + self.act_md5 = self.dl_links[self.version][self.arch[0]][1] + + def download(self): + print_color("Downloading LiteGapps now .....", bcolors.GREEN) + super().download() + + def copy(self): + if os.path.exists(self.copy_dir): + shutil.rmtree(self.copy_dir) + if not os.path.exists(self.extract_to): + os.makedirs(self.extract_to) + if not os.path.exists(os.path.join(self.extract_to, "appunpack")): + os.makedirs(os.path.join(self.extract_to, "appunpack")) + + # extract extract_to/files/files.tar.xz file to extract_to/appunpack + run( [ "tar", "-xvf", os.path.join(self.extract_to, "files", "files.tar.xz"), "-C", os.path.join(self.extract_to, "appunpack"), ]) + shutil.copytree( os.path.join( self.extract_to, "appunpack", self.arch[0], self.api_level_map[self.version], "system",), os.path.join(self.copy_dir, "system"), dirs_exist_ok=True,) \ No newline at end of file diff --git a/stuffs/magisk.py b/stuff/magisk.py similarity index 93% rename from stuffs/magisk.py rename to stuff/magisk.py index c2cabc9..544f3d6 100644 --- a/stuffs/magisk.py +++ b/stuff/magisk.py @@ -2,7 +2,7 @@ import gzip import os import shutil import re -from stuffs.general import General +from stuff.general import General from tools.helper import bcolors, download_file, host, print_color, run, get_download_dir class Magisk(General): @@ -69,7 +69,13 @@ on property:init.svc.zygote=stopped print_color("Copying magisk libs now ...", bcolors.GREEN) - lib_dir = os.path.join(self.extract_to, "lib", self.machine[0]) + arch_map = { + "x86": "x86", + "x86_64": "x86_64", + "arm": "armeabi-v7a", + "arm64": "arm64-v8a" + } + lib_dir = os.path.join(self.extract_to, "lib", arch_map[self.machine[0]]) for parent, dirnames, filenames in os.walk(lib_dir): for filename in filenames: o_path = os.path.join(lib_dir, filename) diff --git a/stuffs/ndk.py b/stuff/ndk.py similarity index 98% rename from stuffs/ndk.py rename to stuff/ndk.py index 7ea99b1..4d65a17 100644 --- a/stuffs/ndk.py +++ b/stuff/ndk.py @@ -1,6 +1,6 @@ import os import shutil -from stuffs.general import General +from stuff.general import General from tools.helper import bcolors, get_download_dir, print_color, run class Ndk(General): diff --git a/stuffs/widevine.py b/stuff/widevine.py similarity index 97% rename from stuffs/widevine.py rename to stuff/widevine.py index 6e9aee0..5a6246d 100644 --- a/stuffs/widevine.py +++ b/stuff/widevine.py @@ -1,7 +1,7 @@ import os import re import shutil -from stuffs.general import General +from stuff.general import General from tools.helper import bcolors, get_download_dir, host, print_color, run @@ -28,12 +28,12 @@ class Widevine(General): "13.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a8524d608431573ef1c9313822d271f78728f9a6.zip", "5c55df61da5c012b4e43746547ab730f"] }, - # "armeabi-v7a": + # "arm": # { # "11.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/7b6e37ef0b63408f7d0232e67192020ba0aa402b.zip", # "3c3a136dc926ae5fc07826359720dbab"] # }, - "arm64-v8a": { + "arm64": { "11.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", "fed6898b5cfd2a908cb134df97802554"] } diff --git a/stuffs/litegapps.py b/stuffs/litegapps.py deleted file mode 100644 index a83655a..0000000 --- a/stuffs/litegapps.py +++ /dev/null @@ -1,49 +0,0 @@ -import os -import shutil -from stuffs.general import General -from tools.helper import get_download_dir, host, print_color, run, bcolors - -class LiteGapps(General): - # https://master.dl.sourceforge.net/project/litegapps/litegapps/x86_64/33/lite/2024-02-24/AUTO-LiteGapps-x86_64-13.0-20240224-official.zip?viasf=1 - dl_link_fmt = "https://master.dl.sourceforge.net/project/litegapps/litegapps/{0}/{1}/lite/2024-02-24/AUTO-LiteGapps-{0}-{2}-20240224-official.zip" - api_level_map = { - "15.0.0": "35", - "14.0.0": "34", - "13.0.0": "33", - "12.0.0": "31", - "11.0.0": "30", - "10.0.0": "29", - "9.0.0": "28", - "8.1.0": "27", - "8.0.0": "26", - "7.1.2": "25", - "7.1.1": "25", - "7.1.0": "25", - "7.0.0": "24", - } - arch = host() - download_loc = get_download_dir() - dl_file_name = os.path.join(download_loc, "litegapps.zip") - act_md5 = "" - copy_dir = "./litegapps" - extract_to = "/tmp/litegapps/extract" - - def __init__(self, version): - self.version = version - self.dl_link = self.dl_link_fmt.format(self.arch[0], self.api_level_map[self.version], '.'.join(self.version.split('.')[:2])) - - def download(self): - print_color("Downloading LiteGapps now .....", bcolors.GREEN) - super().download() - - def copy(self): - if os.path.exists(self.copy_dir): - shutil.rmtree(self.copy_dir) - if not os.path.exists(self.extract_to): - os.makedirs(self.extract_to) - if not os.path.exists(os.path.join(self.extract_to, "appunpack")): - os.makedirs(os.path.join(self.extract_to, "appunpack")) - - # extract extract_to/files/files.tar.xz file to extract_to/appunpack - run(["tar", "-xvf", os.path.join(self.extract_to, "files", "files.tar.xz"), "-C", os.path.join(self.extract_to, "appunpack")]) - shutil.copytree(os.path.join(self.extract_to, "appunpack", self.arch[0], self.api_level_map[self.version], "system"), os.path.join(self.copy_dir, "system"), dirs_exist_ok=True) \ No newline at end of file diff --git a/tools/helper.py b/tools/helper.py index a89dbd4..d0d5796 100644 --- a/tools/helper.py +++ b/tools/helper.py @@ -50,9 +50,9 @@ def host(): mapping = { "i686": ("x86", 32), "x86_64": ("x86_64", 64), - "aarch64": ("arm64-v8a", 64), - "armv7l": ("armeabi-v7a", 32), - "armv8l": ("armeabi-v7a", 32) + "aarch64": ("arm64", 64), + "armv7l": ("arm", 32), + "armv8l": ("arm", 32) } if machine in mapping: # if mapping[machine] == "x86_64":