s''
This commit is contained in:
34
stuff/general.py
Normal file
34
stuff/general.py
Normal file
@@ -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()
|
||||
96
stuff/houdini.py
Normal file
96
stuff/houdini.py
Normal file
@@ -0,0 +1,96 @@
|
||||
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 binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
|
||||
|
||||
on property:ro.enable.native.bridge.exec=1
|
||||
copy /vendor/etc/binfmt_misc/arm_exe /proc/sys/fs/binfmt_misc/register
|
||||
copy /vendor/etc/binfmt_misc/arm_dyn /proc/sys/fs/binfmt_misc/register
|
||||
|
||||
on property:ro.enable.native.bridge.exec64=1
|
||||
copy /vendor/etc/binfmt_misc/arm64_exe /proc/sys/fs/binfmt_misc/register
|
||||
copy /vendor/etc/binfmt_misc/arm64_dyn /proc/sys/fs/binfmt_misc/register
|
||||
|
||||
on property:sys.boot_completed=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 = {
|
||||
# 8.1.0 from cros R79 Android N not working
|
||||
# "8.1.0":[
|
||||
# "https://github.com/rote66/vendor_intel_proprietary_houdini/archive/9246014ddf22d5e34f294d726dc48ca446b0e20e.zip",
|
||||
# "b0a9ddc0d817d290a15b132091a37f36"],
|
||||
"8.1.0":[
|
||||
"https://github.com/rote66/vendor_intel_proprietary_houdini/archive/46682f423b8497db3f96222f2669d770eff764c3.zip",
|
||||
"cd4dd2891aa18e7699d33dcc3fe3ffd4"],
|
||||
"9.0.0":[
|
||||
"https://github.com/rote66/vendor_intel_proprietary_houdini/archive/46682f423b8497db3f96222f2669d770eff764c3.zip",
|
||||
"cd4dd2891aa18e7699d33dcc3fe3ffd4"],
|
||||
"11.0.0": [
|
||||
"https://github.com/rote66/vendor_intel_proprietary_houdini/archive/debc3dc91cf12b5c5b8a1c546a5b0b7bf7f838a8.zip",
|
||||
"cb7ffac26d47ec7c89df43818e126b47"],
|
||||
"12.0.0": [
|
||||
"https://github.com/rote66/vendor_intel_proprietary_houdini/archive/debc3dc91cf12b5c5b8a1c546a5b0b7bf7f838a8.zip",
|
||||
"cb7ffac26d47ec7c89df43818e126b47"],
|
||||
"13.0.0": [
|
||||
"https://github.com/rote66/vendor_intel_proprietary_houdini/archive/debc3dc91cf12b5c5b8a1c546a5b0b7bf7f838a8.zip",
|
||||
"cb7ffac26d47ec7c89df43818e126b47"],
|
||||
"14.0.0": [
|
||||
"https://github.com/rote66/vendor_intel_proprietary_houdini/archive/debc3dc91cf12b5c5b8a1c546a5b0b7bf7f838a8.zip",
|
||||
"cb7ffac26d47ec7c89df43818e126b47"]
|
||||
# "15.0.0": [
|
||||
# "https://github.com/rote66/vendor_intel_proprietary_houdini/archive/debc3dc91cf12b5c5b8a1c546a5b0b7bf7f838a8.zip",
|
||||
# "cb7ffac26d47ec7c89df43818e126b47"]
|
||||
}
|
||||
dl_file_name = os.path.join(download_loc, "libhoudini.zip")
|
||||
extract_to = os.path.join(download_loc, "houdini_extract")
|
||||
|
||||
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(r"([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)
|
||||
|
||||
system_binfmt_dir = os.path.join(self.copy_dir, "system", "etc", "binfmt_misc")
|
||||
vendor_binfmt_dir = os.path.join(self.copy_dir, "vendor", "etc", "binfmt_misc")
|
||||
os.makedirs(vendor_binfmt_dir, exist_ok=True)
|
||||
for filename in ["arm_exe", "arm_dyn", "arm64_exe", "arm64_dyn"]:
|
||||
shutil.copyfile(
|
||||
os.path.join(system_binfmt_dir, filename),
|
||||
os.path.join(vendor_binfmt_dir, filename),
|
||||
)
|
||||
|
||||
init_path = os.path.join(self.copy_dir, "vendor", "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)
|
||||
33
stuff/houdini_hack.py
Normal file
33
stuff/houdini_hack.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from stuff.general import General
|
||||
from tools.helper import bcolors, get_download_dir, print_color, run
|
||||
|
||||
|
||||
class Houdini_Hack(General):
|
||||
download_loc = get_download_dir()
|
||||
copy_dir = "./houdini"
|
||||
dl_file_name = os.path.join(download_loc, "libhoudini_hack.zip")
|
||||
extract_to = os.path.join(download_loc, "houdini_hack_extract")
|
||||
|
||||
def __init__(self, version):
|
||||
self.version = version
|
||||
self.dl_link = "https://github.com/rote66/redroid_libhoudini_hack/archive/a2194c5e294cbbfdfe87e51eb9eddb4c3621d8c3.zip"
|
||||
self.act_md5 = "8f71a58f3e54eca879a2f7de64dbed58"
|
||||
|
||||
def download(self):
|
||||
print_color("Downloading libhoudini_hack now .....", bcolors.GREEN)
|
||||
super().download()
|
||||
|
||||
def copy(self):
|
||||
run(["chmod", "+x", self.extract_to, "-R"])
|
||||
|
||||
print_color("Copying libhoudini hack files ...", bcolors.GREEN)
|
||||
name = re.findall(r"([a-zA-Z0-9]+)\.zip", self.dl_link)[0]
|
||||
shutil.copytree(os.path.join(self.extract_to, "redroid_libhoudini_hack-" + name,
|
||||
self.version), os.path.join(self.copy_dir, "system"), dirs_exist_ok=True)
|
||||
|
||||
if not self.version == "9.0.0":
|
||||
init_path = os.path.join(self.copy_dir, "system", "etc", "init", "hw", "init.rc")
|
||||
os.chmod(init_path, 0o644)
|
||||
275
stuff/magisk.py
Normal file
275
stuff/magisk.py
Normal file
@@ -0,0 +1,275 @@
|
||||
import os
|
||||
import shutil
|
||||
import re
|
||||
import zipfile
|
||||
import requests
|
||||
from stuff.general import General
|
||||
from tools.helper import bcolors, download_file, host, print_color, run, get_download_dir
|
||||
|
||||
class Magisk(General):
|
||||
stable_json = "https://raw.githubusercontent.com/os-fork/HuskyDG-magisk-files/main/stable.json"
|
||||
machine = host()
|
||||
|
||||
def __init__(self):
|
||||
self.download_loc = get_download_dir()
|
||||
self.dl_file_name = os.path.join(self.download_loc, "magisk.apk")
|
||||
self.release_meta_file = os.path.join(self.download_loc, "magisk.version")
|
||||
self.extract_to = os.path.join(self.download_loc, "magisk_unpack")
|
||||
self.copy_dir = "./magisk"
|
||||
self.magisk_dir = os.path.join(self.copy_dir, "vendor", "etc", "magisk")
|
||||
self.rc_dir = os.path.join(self.copy_dir, "vendor", "etc", "init")
|
||||
self.app_package = os.environ.get("REDROID_MAGISK_APP_PACKAGE", "io.github.huskydg.magisk")
|
||||
self.custom_apk = os.environ.get("REDROID_MAGISK_APK", "").strip()
|
||||
self.custom_url = os.environ.get("REDROID_MAGISK_URL", "").strip()
|
||||
self.boot_complete_enabled = os.environ.get("REDROID_MAGISK_BOOT_COMPLETE", "0").strip().lower() in {
|
||||
"1",
|
||||
"true",
|
||||
"yes",
|
||||
"on",
|
||||
}
|
||||
self.preseed_sql = os.environ.get(
|
||||
"REDROID_MAGISK_PRESEED_SQL",
|
||||
"REPLACE INTO settings (key,value) VALUES "
|
||||
"('root_access',3),('su_biometric',0),('multiuser_mode',0),('mnt_ns',1),"
|
||||
"('denylist',0),('sulist',0),('zygisk',1); "
|
||||
"REPLACE INTO policies (uid,policy,until,logging,notification) VALUES "
|
||||
"(2000,2,0,0,0);",
|
||||
).strip()
|
||||
self.release_version = "unknown"
|
||||
self.magisk_tmp = "/debug_ramdisk"
|
||||
self.magisk_bootstrap = "magisk64" if self.machine[1] == 64 else "magisk32"
|
||||
self.magisk_system_dir = "/vendor/etc/magisk"
|
||||
boot_complete_component = ""
|
||||
if self.boot_complete_enabled:
|
||||
boot_complete_component = """
|
||||
exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --boot-complete""".format(
|
||||
MAGISKTMP=self.magisk_tmp,
|
||||
)
|
||||
preseed_component = ""
|
||||
if self.preseed_sql:
|
||||
escaped_sql = self.preseed_sql.replace("\\", "\\\\").replace('"', '\\"')
|
||||
preseed_component = """
|
||||
exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --sqlite "{PRESEED_SQL}" """.format(
|
||||
MAGISKTMP=self.magisk_tmp,
|
||||
PRESEED_SQL=escaped_sql,
|
||||
)
|
||||
self.bootanim_component = """
|
||||
on post-fs-data
|
||||
start logd
|
||||
mount tmpfs tmpfs {MAGISKTMP} mode=1777
|
||||
mkdir /data/adb 0700
|
||||
mkdir /data/adb/magisk 0755
|
||||
copy {MAGISKSYSTEMDIR}/busybox /data/adb/magisk/busybox
|
||||
copy {MAGISKSYSTEMDIR}/magiskboot /data/adb/magisk/magiskboot
|
||||
copy {MAGISKSYSTEMDIR}/magiskinit /data/adb/magisk/magiskinit
|
||||
copy {MAGISKSYSTEMDIR}/magiskpolicy /data/adb/magisk/magiskpolicy
|
||||
copy {MAGISKSYSTEMDIR}/util_functions.sh /data/adb/magisk/util_functions.sh
|
||||
copy {MAGISKSYSTEMDIR}/boot_patch.sh /data/adb/magisk/boot_patch.sh
|
||||
copy {MAGISKSYSTEMDIR}/addon.d.sh /data/adb/magisk/addon.d.sh
|
||||
chmod 0755 /data/adb/magisk/busybox
|
||||
chmod 0755 /data/adb/magisk/magiskboot
|
||||
chmod 0755 /data/adb/magisk/magiskinit
|
||||
chmod 0755 /data/adb/magisk/magiskpolicy
|
||||
chmod 0644 /data/adb/magisk/util_functions.sh
|
||||
chmod 0644 /data/adb/magisk/boot_patch.sh
|
||||
chmod 0644 /data/adb/magisk/addon.d.sh
|
||||
copy {MAGISKSYSTEMDIR}/magisk32 {MAGISKTMP}/magisk32
|
||||
copy {MAGISKSYSTEMDIR}/magisk64 {MAGISKTMP}/magisk64
|
||||
copy {MAGISKSYSTEMDIR}/magiskpolicy {MAGISKTMP}/magiskpolicy
|
||||
copy {MAGISKSYSTEMDIR}/stub.apk {MAGISKTMP}/stub.apk
|
||||
chmod 0755 {MAGISKTMP}/magisk32
|
||||
chmod 0755 {MAGISKTMP}/magisk64
|
||||
chmod 0755 {MAGISKTMP}/magiskpolicy
|
||||
symlink {MAGISKTMP}/{magisk_bootstrap} {MAGISKTMP}/magisk
|
||||
symlink {MAGISKTMP}/magisk {MAGISKTMP}/su
|
||||
symlink {MAGISKTMP}/magisk {MAGISKTMP}/resetprop
|
||||
symlink {MAGISKTMP}/magiskpolicy {MAGISKTMP}/supolicy
|
||||
rm /vendor/bin/su
|
||||
rm /vendor/bin/magisk
|
||||
rm /vendor/bin/resetprop
|
||||
rm /vendor/bin/magiskpolicy
|
||||
symlink {MAGISKTMP}/magisk /vendor/bin/su
|
||||
symlink {MAGISKTMP}/magisk /vendor/bin/magisk
|
||||
symlink {MAGISKTMP}/magisk /vendor/bin/resetprop
|
||||
symlink {MAGISKTMP}/magiskpolicy /vendor/bin/magiskpolicy
|
||||
mkdir {MAGISKTMP}/.magisk 0711
|
||||
mkdir {MAGISKTMP}/.magisk/device 0711
|
||||
mkdir {MAGISKTMP}/.magisk/mirror 0755
|
||||
mkdir {MAGISKTMP}/.magisk/block 0755
|
||||
mkdir {MAGISKTMP}/.magisk/worker 0755
|
||||
mkdir {MAGISKTMP}/.magisk/rootdir 0755
|
||||
copy {MAGISKSYSTEMDIR}/config {MAGISKTMP}/.magisk/config
|
||||
exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --post-fs-data
|
||||
|
||||
on nonencrypted
|
||||
exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --service
|
||||
|
||||
on property:vold.decrypt=trigger_restart_framework
|
||||
exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --service
|
||||
|
||||
on property:sys.boot_completed=1
|
||||
mkdir /data/adb/magisk 755
|
||||
{PRESEED}
|
||||
{BOOTCOMPLETE}
|
||||
exec -- /system/bin/sh -c "if [ ! -e /data/data/{app_package} ] ; then pm install {MAGISKSYSTEMDIR}/magisk.apk ; fi"
|
||||
|
||||
on property:init.svc.zygote=restarting
|
||||
exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --zygote-restart
|
||||
|
||||
on property:init.svc.zygote=stopped
|
||||
exec u:r:su:s0 root root -- {MAGISKTMP}/magisk --zygote-restart
|
||||
""".format(
|
||||
MAGISKSYSTEMDIR=self.magisk_system_dir,
|
||||
MAGISKTMP=self.magisk_tmp,
|
||||
PRESEED=preseed_component,
|
||||
BOOTCOMPLETE=boot_complete_component,
|
||||
magisk_bootstrap=self.magisk_bootstrap,
|
||||
app_package=self.app_package,
|
||||
)
|
||||
|
||||
def _cached_version(self):
|
||||
if os.path.isfile(self.release_meta_file):
|
||||
with open(self.release_meta_file, "r", encoding="utf-8") as meta_file:
|
||||
return meta_file.read().strip()
|
||||
return ""
|
||||
|
||||
def _write_version(self):
|
||||
with open(self.release_meta_file, "w", encoding="utf-8") as meta_file:
|
||||
meta_file.write(self.release_version)
|
||||
|
||||
def _validate_archive(self):
|
||||
if not zipfile.is_zipfile(self.dl_file_name):
|
||||
raise ValueError(
|
||||
"Downloaded Magisk/Kitsune archive is not a valid APK/ZIP. "
|
||||
"Set REDROID_MAGISK_APK to a local APK or REDROID_MAGISK_URL to a working direct APK URL."
|
||||
)
|
||||
|
||||
def resolve_release(self):
|
||||
print_color("Resolving Kitsune Mask stable release ...", bcolors.GREEN)
|
||||
response = requests.get(self.stable_json, timeout=30)
|
||||
response.raise_for_status()
|
||||
payload = response.json()
|
||||
magisk_info = payload["magisk"]
|
||||
self.dl_link = magisk_info["link"]
|
||||
self.release_version = magisk_info.get("version", "unknown")
|
||||
|
||||
def download(self):
|
||||
if self.custom_apk:
|
||||
self.release_version = "local:" + os.path.basename(self.custom_apk)
|
||||
if (
|
||||
os.path.isfile(self.dl_file_name)
|
||||
and self._cached_version() == self.release_version
|
||||
):
|
||||
print_color(
|
||||
"Using cached local Magisk/Kitsune APK {} ...".format(self.release_version),
|
||||
bcolors.GREEN,
|
||||
)
|
||||
else:
|
||||
print_color(
|
||||
"Copying local Magisk/Kitsune APK {} ...".format(self.custom_apk),
|
||||
bcolors.GREEN,
|
||||
)
|
||||
shutil.copyfile(self.custom_apk, self.dl_file_name)
|
||||
self._write_version()
|
||||
self._validate_archive()
|
||||
return
|
||||
|
||||
if self.custom_url:
|
||||
self.dl_link = self.custom_url
|
||||
self.release_version = "url:" + os.path.basename(self.custom_url)
|
||||
else:
|
||||
self.resolve_release()
|
||||
|
||||
if (
|
||||
os.path.isfile(self.dl_file_name)
|
||||
and self._cached_version() == self.release_version
|
||||
):
|
||||
print_color(
|
||||
"Using cached Kitsune Mask {} ...".format(self.release_version),
|
||||
bcolors.GREEN,
|
||||
)
|
||||
self._validate_archive()
|
||||
return
|
||||
|
||||
print_color(
|
||||
"Downloading Kitsune Mask {} now .....".format(self.release_version),
|
||||
bcolors.GREEN,
|
||||
)
|
||||
if os.path.isfile(self.dl_file_name):
|
||||
os.remove(self.dl_file_name)
|
||||
download_file(self.dl_link, self.dl_file_name)
|
||||
self._validate_archive()
|
||||
self._write_version()
|
||||
|
||||
def extract(self):
|
||||
print_color("Extracting archive...", bcolors.GREEN)
|
||||
if os.path.exists(self.extract_to):
|
||||
shutil.rmtree(self.extract_to)
|
||||
os.makedirs(self.extract_to, exist_ok=True)
|
||||
with zipfile.ZipFile(self.dl_file_name) as zip_handle:
|
||||
zip_handle.extractall(self.extract_to)
|
||||
|
||||
def copy(self):
|
||||
if os.path.exists(self.copy_dir):
|
||||
shutil.rmtree(self.copy_dir)
|
||||
os.makedirs(self.magisk_dir, exist_ok=True)
|
||||
os.makedirs(self.rc_dir, exist_ok=True)
|
||||
os.chmod(os.path.join(self.copy_dir, "vendor"), 0o755)
|
||||
os.chmod(os.path.join(self.copy_dir, "vendor", "etc"), 0o755)
|
||||
os.chmod(self.magisk_dir, 0o755)
|
||||
os.chmod(self.rc_dir, 0o755)
|
||||
|
||||
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(r'lib(.*)\.so', filename)
|
||||
n_path = os.path.join(self.magisk_dir, filename.group(1))
|
||||
shutil.copyfile(o_path, n_path)
|
||||
os.chmod(n_path, 0o755)
|
||||
|
||||
if self.machine[1] == 64:
|
||||
secondary_arch_map = {
|
||||
"x86_64": "x86",
|
||||
"arm64": "armeabi-v7a",
|
||||
}
|
||||
secondary_dir = os.path.join(
|
||||
self.extract_to,
|
||||
"lib",
|
||||
secondary_arch_map[self.machine[0]],
|
||||
)
|
||||
magisk32_src = os.path.join(secondary_dir, "libmagisk32.so")
|
||||
if os.path.exists(magisk32_src):
|
||||
magisk32_dst = os.path.join(self.magisk_dir, "magisk32")
|
||||
shutil.copyfile(magisk32_src, magisk32_dst)
|
||||
os.chmod(magisk32_dst, 0o755)
|
||||
|
||||
assets_dir = os.path.join(self.extract_to, "assets")
|
||||
for asset_name in ["util_functions.sh", "addon.d.sh", "boot_patch.sh", "stub.apk"]:
|
||||
asset_src = os.path.join(assets_dir, asset_name)
|
||||
if os.path.exists(asset_src):
|
||||
asset_dst = os.path.join(self.magisk_dir, asset_name)
|
||||
shutil.copyfile(asset_src, asset_dst)
|
||||
os.chmod(asset_dst, 0o644)
|
||||
|
||||
config_path = os.path.join(self.magisk_dir, "config")
|
||||
with open(config_path, "w", encoding="utf-8") as config_file:
|
||||
config_file.write("SYSTEMMODE=true\nRECOVERYMODE=false\n")
|
||||
os.chmod(config_path, 0o600)
|
||||
|
||||
magisk_apk_path = os.path.join(self.magisk_dir, "magisk.apk")
|
||||
shutil.copyfile(self.dl_file_name, magisk_apk_path)
|
||||
os.chmod(magisk_apk_path, 0o644)
|
||||
|
||||
magisk_rc_path = os.path.join(self.rc_dir, "magisk.rc")
|
||||
with open(magisk_rc_path, "w", encoding="utf-8") as initfile:
|
||||
initfile.write(self.bootanim_component)
|
||||
os.chmod(magisk_rc_path, 0o644)
|
||||
124
stuff/mindthegapps.py
Normal file
124
stuff/mindthegapps.py
Normal file
@@ -0,0 +1,124 @@
|
||||
import os
|
||||
import shutil
|
||||
from stuff.general import General
|
||||
from tools.helper import get_download_dir, host, print_color, run, bcolors
|
||||
|
||||
|
||||
class MindTheGapps(General):
|
||||
dl_links = {
|
||||
"15.0.0": {
|
||||
"x86_64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20250330/MindTheGapps-15.0.0-x86_64-20250330.zip",
|
||||
"e54694828bd74e9066b2534a9675c31e",
|
||||
],
|
||||
"arm64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20250330/MindTheGapps-15.0.0-arm64-20250330.zip",
|
||||
"79acb62f0f7c66b0f0bcadae5624f3d1",
|
||||
],
|
||||
"arm": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20250330/MindTheGapps-15.0.0-arm-20250330.zip",
|
||||
"4ced6a404a714e61831e16068c3642b3",
|
||||
],
|
||||
},
|
||||
"14.0.0": {
|
||||
"x86_64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-14.0.0-x86_64-20240226.zip",
|
||||
"a827a84ccb0cf5914756e8561257ed13",
|
||||
],
|
||||
"x86": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-14.0.0-x86-20240226.zip",
|
||||
"45736b21475464e4a45196b9aa9d3b7f",
|
||||
],
|
||||
"arm64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-14.0.0-arm64-20240226.zip",
|
||||
"a0905cc7bf3f4f4f2e3f59a4e1fc789b",
|
||||
],
|
||||
"arm": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-14.0.0-arm-20240226.zip",
|
||||
"fa167a3b7a10c4d3e688a59cd794f75b",
|
||||
],
|
||||
},
|
||||
"13.0.0": {
|
||||
"x86_64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-13.0.0-x86_64-20240226.zip",
|
||||
"eee87a540b6e778f3a114fff29e133aa",
|
||||
],
|
||||
"x86": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-13.0.0-x86-20240226.zip",
|
||||
"d928c5eabb4394a97f2d7a5c663e7c2e",
|
||||
],
|
||||
"arm64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-13.0.0-arm64-20240226.zip",
|
||||
"ebdf35e17bc1c22337762fcf15cd6e97",
|
||||
],
|
||||
"arm": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240619/MindTheGapps-13.0.0-arm-20240619.zip",
|
||||
"ec7aa5efc9e449b101bc2ee7448a49bf",
|
||||
],
|
||||
},
|
||||
"13.0.0_64only": {
|
||||
"x86_64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-13.0.0-x86_64-20240226.zip",
|
||||
"eee87a540b6e778f3a114fff29e133aa",
|
||||
],
|
||||
"arm64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240226/MindTheGapps-13.0.0-arm64-20240226.zip",
|
||||
"ebdf35e17bc1c22337762fcf15cd6e97",
|
||||
],
|
||||
},
|
||||
"12.0.0_64only": {
|
||||
"x86_64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240619/MindTheGapps-12.1.0-x86_64-20240619.zip",
|
||||
"05d6e99b6e6567e66d43774559b15fbd"
|
||||
],
|
||||
"arm64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240619/MindTheGapps-12.1.0-arm64-20240619.zip",
|
||||
"94dd174ff16c2f0006b66b25025efd04",
|
||||
],
|
||||
},
|
||||
"12.0.0": {
|
||||
"x86_64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240619/MindTheGapps-12.1.0-x86_64-20240619.zip",
|
||||
"05d6e99b6e6567e66d43774559b15fbd"
|
||||
],
|
||||
"x86": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240619/MindTheGapps-12.1.0-x86-20240619.zip",
|
||||
"ff2421a75afbdda8a003e4fd25e95050"
|
||||
],
|
||||
"arm64": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240619/MindTheGapps-12.1.0-arm64-20240619.zip",
|
||||
"94dd174ff16c2f0006b66b25025efd04",
|
||||
],
|
||||
"arm": [
|
||||
"https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20240619/MindTheGapps-12.1.0-arm-20240619.zip",
|
||||
"5af756b3b5776c2f6ee024a9f7f42a2f",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
arch = host()
|
||||
download_loc = get_download_dir()
|
||||
dl_file_name = os.path.join(download_loc, "mindthegapps.zip")
|
||||
dl_link = ...
|
||||
act_md5 = ...
|
||||
copy_dir = "./mindthegapps"
|
||||
extract_to = os.path.join(download_loc, "mindthegapps_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 MindTheGapps 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)
|
||||
|
||||
shutil.copytree(
|
||||
os.path.join(self.extract_to, "system", ),
|
||||
os.path.join(self.copy_dir, "system"), dirs_exist_ok=True, )
|
||||
Reference in New Issue
Block a user