Compare commits

..
Author SHA1 Message Date
Семён Марьясин 963e3511fe Fix forgotten commas in microg.py
Choosing Minimal variants resulted in this without my fix:

  File "/nix/store/2a3cl1fvl0418qmkrvndx4si29w9yvv5-waydroid-script-0-unstable-2026-01-05/lib/python3.13/site-packages/stuff/microg.py", line 109, in __init__
    self.act_md5 = self.dl_links[variant][1]
                   ~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
2026-04-14 19:04:01 +03:00
3 changed files with 5 additions and 88 deletions
+3 -8
View File
@@ -18,7 +18,6 @@ from stuff.nodataperm import Nodataperm
from stuff.smartdock import Smartdock
from stuff.widevine import Widevine
from stuff.fdroidpriv import FDroidPriv
from stuff.tflitefix import TfliteFix
import tools.helper as helper
from tools import container
from tools import images
@@ -145,8 +144,6 @@ def remove_app(args):
remove_list.append(Nodataperm(args.android_version))
if "hidestatusbar" in app:
remove_list.append(HideStatusBar())
if "tflitefix" in app:
remove_list.append(TfliteFix())
if not container.use_overlayfs():
copy_dir = "/tmp/waydroid"
@@ -172,8 +169,6 @@ def hack_option(args):
hack_list.append(Nodataperm())
if "hidestatusbar" in options:
hack_list.append(HideStatusBar())
if "tflitefix" in options:
hack_list.append(TfliteFix())
if not container.use_overlayfs():
copy_dir = "/tmp/waydroid"
@@ -209,7 +204,7 @@ def interact():
args = argparse.Namespace()
android_version = inquirer.select(
message="Select Android version",
instruction="(↑↓ Select Item)",
instruction="(\u2191\u2193 Select Item)",
choices=[
Choice(name="Android 11", value="11"),
Choice(name="Android 13", value="13"),
@@ -235,7 +230,7 @@ def interact():
exit()
install_choices = ["gapps", "microg", "libndk", "libhoudini", "magisk", "smartdock", "fdroidpriv", "widevine",]
hack_choices = ["tflitefix"]
hack_choices = []
if android_version=="11":
hack_choices.extend(["nodataperm", "hidestatusbar"])
@@ -302,7 +297,7 @@ def main():
install_choices = ["gapps", "microg", "libndk", "libhoudini",
"magisk", "mitm", "smartdock", "widevine"]
hack_choices = ["nodataperm", "hidestatusbar", "tflitefix"]
hack_choices = ["nodataperm", "hidestatusbar"]
micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"]
remove_choices = install_choices
+2 -2
View File
@@ -36,11 +36,11 @@ class MicroG(General):
"6136b383153c2a6797d14fb4d7ca3f97"
],
"Minimal": [
"https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-Minimal-2.11.1-20230429100521.zip"
"https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-Minimal-2.11.1-20230429100521.zip",
"afb87eb64e7749cfd72c4760d85849da"
],
"MinimalIAP": [
"https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-MinimalIAP-2.11.1-20230429100556.zip"
"https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-MinimalIAP-2.11.1-20230429100556.zip",
"cc071f4f776cbc16c4c1f707aff1f7fa"
]
}
-78
View File
@@ -1,78 +0,0 @@
import glob
import os
import shutil
from stuff.general import General
from tools.logger import Logger
class TfliteFix(General):
id = "tflitefix"
partition = "system"
TARGET_OFFSET = 0x2E9204
PATCH_BYTES = b"\xc0\x03\x5f\xd6" # ret in AArch64 little-endian
def __init__(self, android_version="13") -> None:
super().__init__()
def download(self):
pass
@property
def skip_extract(self):
return True
def copy(self):
pass
def extra1(self):
"""Applies binary patch to libtensorflowlite.so in installed apps"""
search_paths = [
os.path.expanduser("~/.local/share/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so"),
"/var/lib/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so",
]
found = []
for p in search_paths:
found.extend(glob.glob(p))
if not found:
Logger.warning("No installed apps with libtensorflowlite.so found in Waydroid data.")
return
for lib_path in found:
try:
with open(lib_path, "rb") as f:
data = bytearray(f.read())
if len(data) > self.TARGET_OFFSET + 4:
if bytes(data[self.TARGET_OFFSET:self.TARGET_OFFSET+4]) == self.PATCH_BYTES:
Logger.info(f"Patch already applied to {lib_path}")
continue
backup = lib_path + ".orig"
if not os.path.exists(backup):
shutil.copy2(lib_path, backup)
data[self.TARGET_OFFSET:self.TARGET_OFFSET+4] = self.PATCH_BYTES
with open(lib_path, "wb") as f:
f.write(data)
os.chmod(lib_path, 0o755)
Logger.info(f"Successfully patched {lib_path}")
except Exception as e:
Logger.error(f"Failed to patch {lib_path}: {e}")
def extra2(self):
"""Restores original libtensorflowlite.so from backup"""
search_paths = [
os.path.expanduser("~/.local/share/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so.orig"),
"/var/lib/waydroid/data/app/~~*==/*/lib/arm64/libtensorflowlite.so.orig",
]
for p in search_paths:
for orig in glob.glob(p):
target = orig[:-5]
try:
shutil.copy2(orig, target)
os.remove(orig)
os.chmod(target, 0o755)
Logger.info(f"Restored {target}")
except Exception as e:
Logger.error(f"Failed to restore {target}: {e}")