mirror of
https://github.com/ayasa520/redroid-script.git
synced 2026-11-25 14:24:33 +08:00
Add md5sum verification for litegapps
This commit is contained in:
1 parent
ccc8d9701d
commit
36a5a4cebd
12 files changed
+247
-68
No files matched your search
@@ -0,0 +1,62 @@
|
||||
import os
|
||||
import shutil
|
||||
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": ["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()
|
||||
dl_link = dl_links[arch[0]][0]
|
||||
dl_file_name = os.path.join(download_loc, "open_gapps.zip")
|
||||
act_md5 = dl_links[arch[0]][1]
|
||||
copy_dir = "./gapps"
|
||||
extract_to = "/tmp/ogapps/extract"
|
||||
non_apks = [
|
||||
"defaultetc-common.tar.lz",
|
||||
"defaultframework-common.tar.lz",
|
||||
"googlepixelconfig-common.tar.lz",
|
||||
"vending-common.tar.lz"
|
||||
]
|
||||
skip = [
|
||||
"setupwizarddefault-x86_64.tar.lz",
|
||||
"setupwizardtablet-x86_64.tar.lz"
|
||||
]
|
||||
|
||||
def download(self):
|
||||
print_color("Downloading OpenGapps 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"))
|
||||
|
||||
for lz_file in os.listdir(os.path.join(self.extract_to, "Core")):
|
||||
for d in os.listdir(os.path.join(self.extract_to, "appunpack")):
|
||||
shutil.rmtree(os.path.join(self.extract_to, "appunpack", d))
|
||||
if lz_file not in self.skip:
|
||||
if lz_file not in self.non_apks:
|
||||
print(" Processing app package : "+os.path.join(self.extract_to, "Core", lz_file))
|
||||
run(["tar", "--lzip", "-xvf", os.path.join(self.extract_to, "Core", lz_file), "-C", os.path.join(self.extract_to, "appunpack")])
|
||||
app_name = os.listdir(os.path.join(self.extract_to, "appunpack"))[0]
|
||||
xx_dpi = os.listdir(os.path.join(self.extract_to, "appunpack", app_name))[0]
|
||||
app_priv = os.listdir(os.path.join(self.extract_to, "appunpack", app_name, "nodpi"))[0]
|
||||
app_src_dir = os.path.join(self.extract_to, "appunpack", app_name, xx_dpi, app_priv)
|
||||
for app in os.listdir(app_src_dir):
|
||||
shutil.copytree(os.path.join(app_src_dir, app), os.path.join(self.copy_dir, "system", "priv-app", app), dirs_exist_ok=True)
|
||||
else:
|
||||
print(" Processing extra package : "+os.path.join(self.extract_to, "Core", lz_file))
|
||||
run(["tar", "--lzip", "-xvf", os.path.join(self.extract_to, "Core", lz_file), "-C", os.path.join(self.extract_to, "appunpack")])
|
||||
app_name = os.listdir(os.path.join(self.extract_to, "appunpack"))[0]
|
||||
common_content_dirs = os.listdir(os.path.join(self.extract_to, "appunpack", app_name, "common"))
|
||||
for ccdir in common_content_dirs:
|
||||
shutil.copytree(os.path.join(self.extract_to, "appunpack", app_name, "common", ccdir), os.path.join(self.copy_dir, "system", ccdir), dirs_exist_ok=True)
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
import os
|
||||
import zipfile
|
||||
import hashlib
|
||||
|
||||
from tools.helper import bcolors, download_file, print_color
|
||||
|
||||
class General:
|
||||
def download(self):
|
||||
loc_md5 = ""
|
||||
if os.path.isfile(self.dl_file_name):
|
||||
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 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)
|
||||
loc_md5 = download_file(self.dl_link, self.dl_file_name)
|
||||
|
||||
def extract(self):
|
||||
print_color("Extracting archive...", bcolors.GREEN)
|
||||
print(self.dl_file_name)
|
||||
print(self.extract_to)
|
||||
with zipfile.ZipFile(self.dl_file_name) as z:
|
||||
z.extractall(self.extract_to)
|
||||
def copy(self):
|
||||
pass
|
||||
def install(self):
|
||||
# pass
|
||||
self.download()
|
||||
self.extract()
|
||||
self.copy()
|
||||
@@ -0,0 +1,66 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from stuff.general import General
|
||||
from tools.helper import bcolors, get_download_dir, print_color, run
|
||||
|
||||
|
||||
class Houdini(General):
|
||||
download_loc = get_download_dir()
|
||||
copy_dir = "./houdini"
|
||||
init_rc_component = """
|
||||
on early-init
|
||||
mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
|
||||
on property:ro.enable.native.bridge.exec=1
|
||||
exec -- /system/bin/sh -c "echo ':arm_exe:M::\\\\x7f\\\\x45\\\\x4c\\\\x46\\\\x01\\\\x01\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x02\\\\x00\\\\x28::/system/bin/houdini:P' > /proc/sys/fs/binfmt_misc/register"
|
||||
exec -- /system/bin/sh -c "echo ':arm_dyn:M::\\\\x7f\\\\x45\\\\x4c\\\\x46\\\\x01\\\\x01\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x03\\\\x00\\\\x28::/system/bin/houdini:P' >> /proc/sys/fs/binfmt_misc/register"
|
||||
exec -- /system/bin/sh -c "echo ':arm64_exe:M::\\\\x7f\\\\x45\\\\x4c\\\\x46\\\\x02\\\\x01\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x02\\\\x00\\\\xb7::/system/bin/houdini64:P' >> /proc/sys/fs/binfmt_misc/register"
|
||||
exec -- /system/bin/sh -c "echo ':arm64_dyn:M::\\\\x7f\\\\x45\\\\x4c\\\\x46\\\\x02\\\\x01\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x03\\\\x00\\\\xb7::/system/bin/houdini64:P' >> /proc/sys/fs/binfmt_misc/register"
|
||||
"""
|
||||
dl_links = {
|
||||
"11.0.0": [
|
||||
"https://github.com/supremegamers/vendor_intel_proprietary_houdini/archive/81f2a51ef539a35aead396ab7fce2adf89f46e88.zip",
|
||||
"fbff756612b4144797fbc99eadcb6653"],
|
||||
"12.0.0": [
|
||||
"https://github.com/supremegamers/vendor_intel_proprietary_houdini/archive/0e0164611d5fe5595229854759c30a9b5c1199a5.zip",
|
||||
"9709701b44b6ab7fc311c7dc95945bd0"],
|
||||
"13.0.0": [
|
||||
"https://github.com/supremegamers/vendor_intel_proprietary_houdini/archive/978d8cba061a08837b7e520cd03b635af643ba08.zip",
|
||||
"1e139054c05034648fae58a1810573b4"
|
||||
],
|
||||
# "9.0.0":[],
|
||||
# "8.1.0":[]
|
||||
}
|
||||
dl_file_name = os.path.join(download_loc, "libhoudini.zip")
|
||||
extract_to = "/tmp/houdiniunpack"
|
||||
|
||||
def __init__(self, version):
|
||||
self.version = version
|
||||
if version in self.dl_links.keys():
|
||||
self.dl_link = self.dl_links[version][0]
|
||||
self.act_md5 = self.dl_links[version][1]
|
||||
else:
|
||||
raise ValueError(
|
||||
"No available libhoudini for Android {}".format(version))
|
||||
|
||||
def download(self):
|
||||
print_color("Downloading libhoudini now .....", bcolors.GREEN)
|
||||
super().download()
|
||||
|
||||
def copy(self):
|
||||
if os.path.exists(self.copy_dir):
|
||||
shutil.rmtree(self.copy_dir)
|
||||
run(["chmod", "+x", self.extract_to, "-R"])
|
||||
|
||||
print_color("Copying libhoudini library files ...", bcolors.GREEN)
|
||||
name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0]
|
||||
shutil.copytree(os.path.join(self.extract_to, "vendor_intel_proprietary_houdini-" + name,
|
||||
"prebuilts"), os.path.join(self.copy_dir, "system"), dirs_exist_ok=True)
|
||||
|
||||
init_path = os.path.join(self.copy_dir, "system", "etc", "init", "houdini.rc")
|
||||
if not os.path.isfile(init_path):
|
||||
os.makedirs(os.path.dirname(init_path), exist_ok=True)
|
||||
with open(init_path, "w") as initfile:
|
||||
initfile.write(self.init_rc_component)
|
||||
os.chmod(init_path, 0o644)
|
||||
@@ -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,)
|
||||
@@ -0,0 +1,97 @@
|
||||
import gzip
|
||||
import os
|
||||
import shutil
|
||||
import re
|
||||
from stuff.general import General
|
||||
from tools.helper import bcolors, download_file, host, print_color, run, get_download_dir
|
||||
|
||||
class Magisk(General):
|
||||
download_loc = get_download_dir()
|
||||
dl_link = "https://web.archive.org/web/20230718224206if_/https://objects.githubusercontent.com/github-production-release-asset-2e65be/514574759/50ec2f91-174b-4918-8587-04e847458bfd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20230718%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230718T224206Z&X-Amz-Expires=300&X-Amz-Signature=ee54e872b4d3c1388601941e85b2fcf84d5e06968618271ea2f5e3ea5947d4e1&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=514574759&response-content-disposition=attachment%3B%20filename%3Dapp-debug.apk&response-content-type=application%2Fvnd.android.package-archive"
|
||||
dl_file_name = os.path.join(download_loc, "magisk.apk")
|
||||
act_md5 = "ec98dcee84a47785dc551eb7c465b25f"
|
||||
extract_to = "/tmp/magisk_unpack"
|
||||
copy_dir = "./magisk"
|
||||
magisk_dir = os.path.join(copy_dir, "system", "etc", "init", "magisk")
|
||||
machine = host()
|
||||
oringinal_bootanim = """
|
||||
service bootanim /system/bin/bootanimation
|
||||
class core animation
|
||||
user graphics
|
||||
group graphics audio
|
||||
disabled
|
||||
oneshot
|
||||
ioprio rt 0
|
||||
task_profiles MaxPerformance
|
||||
|
||||
"""
|
||||
bootanim_component = """
|
||||
on post-fs-data
|
||||
start logd
|
||||
exec u:r:su:s0 root root -- /system/etc/init/magisk/magisk{arch} --auto-selinux --setup-sbin /system/etc/init/magisk
|
||||
exec u:r:su:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk "allow * magisk_file lnk_file *"
|
||||
mkdir /sbin/.magisk 700
|
||||
mkdir /sbin/.magisk/mirror 700
|
||||
mkdir /sbin/.magisk/block 700
|
||||
copy /system/etc/init/magisk/config /sbin/.magisk/config
|
||||
rm /dev/.magisk_unblock
|
||||
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --post-fs-data
|
||||
wait /dev/.magisk_unblock 40
|
||||
rm /dev/.magisk_unblock
|
||||
|
||||
on zygote-start
|
||||
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --service
|
||||
|
||||
on property:sys.boot_completed=1
|
||||
mkdir /data/adb/magisk 755
|
||||
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --boot-complete
|
||||
exec -- /system/bin/sh -c "if [ ! -e /data/data/io.github.huskydg.magisk ] ; then pm install /system/etc/init/magisk/magisk.apk ; fi"
|
||||
|
||||
on property:init.svc.zygote=restarting
|
||||
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart
|
||||
|
||||
on property:init.svc.zygote=stopped
|
||||
exec u:r:su:s0 root root -- /sbin/magisk --auto-selinux --zygote-restart
|
||||
""".format(arch=machine[1])
|
||||
|
||||
def download(self):
|
||||
print_color("Downloading latest Magisk-Delta 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.magisk_dir):
|
||||
os.makedirs(self.magisk_dir, exist_ok=True)
|
||||
|
||||
if not os.path.exists(os.path.join(self.copy_dir, "sbin")):
|
||||
os.makedirs(os.path.join(self.copy_dir, "sbin"), exist_ok=True)
|
||||
|
||||
print_color("Copying magisk libs now ...", bcolors.GREEN)
|
||||
|
||||
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)
|
||||
filename = re.search('lib(.*)\.so', filename)
|
||||
n_path = os.path.join(self.magisk_dir, filename.group(1))
|
||||
shutil.copyfile(o_path, n_path)
|
||||
run(["chmod", "+x", n_path])
|
||||
shutil.copyfile(self.dl_file_name, os.path.join(self.magisk_dir,"magisk.apk") )
|
||||
|
||||
# Updating Magisk from Magisk manager will modify bootanim.rc,
|
||||
# So it is necessary to backup the original bootanim.rc.
|
||||
bootanim_path = os.path.join(self.copy_dir, "system", "etc", "init", "bootanim.rc")
|
||||
gz_filename = os.path.join(bootanim_path)+".gz"
|
||||
with gzip.open(gz_filename,'wb') as f_gz:
|
||||
f_gz.write(self.oringinal_bootanim.encode('utf-8'))
|
||||
with open(bootanim_path, "w") as initfile:
|
||||
initfile.write(self.oringinal_bootanim+self.bootanim_component)
|
||||
|
||||
os.chmod(bootanim_path, 0o644)
|
||||
@@ -0,0 +1,42 @@
|
||||
import os
|
||||
import shutil
|
||||
from stuff.general import General
|
||||
from tools.helper import bcolors, get_download_dir, print_color, run
|
||||
|
||||
class Ndk(General):
|
||||
download_loc = get_download_dir()
|
||||
copy_dir = "./ndk"
|
||||
dl_link = "https://github.com/supremegamers/vendor_google_proprietary_ndk_translation-prebuilt/archive/181d9290a69309511185c4417ba3d890b3caaaa8.zip"
|
||||
dl_file_name = os.path.join(download_loc, "libndktranslation.zip")
|
||||
extract_to = "/tmp/libndkunpack"
|
||||
act_md5 = "0beff55f312492f24d539569d84f5bfb"
|
||||
# init_rc_component = """
|
||||
# # Enable native bridge for target executables
|
||||
# on early-init
|
||||
# mount binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
|
||||
# on property:ro.enable.native.bridge.exec=1
|
||||
# copy /system/etc/binfmt_misc/arm_exe /proc/sys/fs/binfmt_misc/register
|
||||
# copy /system/etc/binfmt_misc/arm_dyn /proc/sys/fs/binfmt_misc/register
|
||||
# copy /system/etc/binfmt_misc/arm64_exe /proc/sys/fs/binfmt_misc/register
|
||||
# copy /system/etc/binfmt_misc/arm64_dyn /proc/sys/fs/binfmt_misc/register
|
||||
# """
|
||||
|
||||
def download(self):
|
||||
print_color("Downloading libndk now .....", bcolors.GREEN)
|
||||
super().download()
|
||||
|
||||
def copy(self):
|
||||
if os.path.exists(self.copy_dir):
|
||||
shutil.rmtree(self.copy_dir)
|
||||
run(["chmod", "+x", self.extract_to, "-R"])
|
||||
|
||||
print_color("Copying libndk library files ...", bcolors.GREEN)
|
||||
shutil.copytree(os.path.join(self.extract_to, "vendor_google_proprietary_ndk_translation-prebuilt-181d9290a69309511185c4417ba3d890b3caaaa8", "prebuilts"), os.path.join(self.copy_dir, "system"), dirs_exist_ok=True)
|
||||
|
||||
init_path = os.path.join(self.copy_dir, "system", "etc", "init", "ndk_translation.rc")
|
||||
os.chmod(init_path, 0o644)
|
||||
# if not os.path.isfile(init_path):
|
||||
# os.makedirs(os.path.dirname(init_path), exist_ok=True)
|
||||
# with open(init_path, "w") as initfile:
|
||||
# initfile.write(self.init_rc_component)
|
||||
@@ -0,0 +1,65 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from stuff.general import General
|
||||
from tools.helper import bcolors, get_download_dir, host, print_color, run
|
||||
|
||||
|
||||
class Widevine(General):
|
||||
def __init__(self, android_version) -> None:
|
||||
super().__init__()
|
||||
self.android_version = android_version
|
||||
self.dl_link = self.dl_links[self.machine[0]][android_version][0]
|
||||
self.act_md5 = self.dl_links[self.machine[0]][android_version][1]
|
||||
|
||||
download_loc = get_download_dir()
|
||||
machine = host()
|
||||
copy_dir = "./widevine"
|
||||
dl_links = {
|
||||
# "x86": {
|
||||
# "11.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/48d1076a570837be6cdce8252d5d143363e37cc1.zip",
|
||||
# "f587b8859f9071da4bca6cea1b9bed6a"]
|
||||
# },
|
||||
"x86_64": {
|
||||
"11.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/48d1076a570837be6cdce8252d5d143363e37cc1.zip",
|
||||
"f587b8859f9071da4bca6cea1b9bed6a"],
|
||||
"12.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/3bba8b6e9dd5ffad5b861310433f7e397e9366e8.zip",
|
||||
"3e147bdeeb7691db4513d93cfa6beb23"],
|
||||
"13.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a8524d608431573ef1c9313822d271f78728f9a6.zip",
|
||||
"5c55df61da5c012b4e43746547ab730f"]
|
||||
},
|
||||
# "arm":
|
||||
# {
|
||||
# "11.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/7b6e37ef0b63408f7d0232e67192020ba0aa402b.zip",
|
||||
# "3c3a136dc926ae5fc07826359720dbab"]
|
||||
# },
|
||||
"arm64": {
|
||||
"11.0.0": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip",
|
||||
"fed6898b5cfd2a908cb134df97802554"]
|
||||
}
|
||||
}
|
||||
dl_file_name = os.path.join(download_loc, "widevine.zip")
|
||||
extract_to = "/tmp/widevineunpack"
|
||||
|
||||
def download(self):
|
||||
print_color("Downloading widevine now .....", bcolors.GREEN)
|
||||
super().download()
|
||||
|
||||
def copy(self):
|
||||
if os.path.exists(self.copy_dir):
|
||||
shutil.rmtree(self.copy_dir)
|
||||
run(["chmod", "+x", self.extract_to, "-R"])
|
||||
print_color("Copying widevine library files ...", bcolors.GREEN)
|
||||
name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0]
|
||||
shutil.copytree(os.path.join(self.extract_to, "vendor_google_proprietary_widevine-prebuilt-"+name,
|
||||
"prebuilts"), os.path.join(self.copy_dir, "vendor"), dirs_exist_ok=True)
|
||||
|
||||
if "x86" in self.machine[0] and self.android_version == "11.0.0":
|
||||
os.symlink("./libprotobuf-cpp-lite-3.9.1.so",
|
||||
os.path.join(self.copy_dir, "vendor", "lib", "libprotobuf-cpp-lite.so"))
|
||||
os.symlink("./libprotobuf-cpp-lite-3.9.1.so", os.path.join(self.copy_dir,
|
||||
"vendor", "lib64", "libprotobuf-cpp-lite.so"))
|
||||
|
||||
for file in os.listdir(os.path.join(self.copy_dir, "vendor", "etc", "init")):
|
||||
if file.endswith('.rc'):
|
||||
os.chmod(os.path.join(self.copy_dir, "vendor", "etc", "init", file), 0o644)
|
||||
Reference in new issue
Block a user