├── requirements.txt ├── bin ├── x86 │ └── resetprop ├── x86_64 │ └── resetprop ├── arm64-v8a │ └── resetprop └── armeabi-v7a │ └── resetprop ├── default.nix ├── tools ├── logger.py ├── images.py ├── container.py └── helper.py ├── flake.nix ├── package.nix ├── stuff ├── hidestatusbar.py ├── mitm.py ├── fdroidpriv.py ├── ndk.py ├── android_id.py ├── widevine.py ├── nodataperm.py ├── houdini.py ├── smartdock.py ├── magisk.py ├── general.py ├── microg.py ├── gps.py └── gapps.py ├── flake.lock ├── .gitignore ├── README.md ├── main.py └── LICENSE /requirements.txt: -------------------------------------------------------------------------------- 1 | tqdm 2 | requests 3 | -------------------------------------------------------------------------------- /bin/x86/resetprop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huakim/waydroid_script/HEAD/bin/x86/resetprop -------------------------------------------------------------------------------- /bin/x86_64/resetprop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huakim/waydroid_script/HEAD/bin/x86_64/resetprop -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let 2 | pkgs = import {}; 3 | in 4 | pkgs.callPackage ./package.nix { } 5 | -------------------------------------------------------------------------------- /bin/arm64-v8a/resetprop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huakim/waydroid_script/HEAD/bin/arm64-v8a/resetprop -------------------------------------------------------------------------------- /bin/armeabi-v7a/resetprop: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huakim/waydroid_script/HEAD/bin/armeabi-v7a/resetprop -------------------------------------------------------------------------------- /tools/logger.py: -------------------------------------------------------------------------------- 1 | class Logger: 2 | 3 | @staticmethod 4 | def error(str): 5 | print("\033[31m"+"ERROR: "+str+"\033[0m") 6 | 7 | @staticmethod 8 | def info(str): 9 | print("\033[32m"+"INFO: "+"\033[0m"+str) 10 | 11 | @staticmethod 12 | def warning(str): 13 | print("\033[33m"+"WARN: "+str+"\033[0m") 14 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Waydroid Extras Script"; 3 | inputs = { 4 | systems.url = "github:nix-systems/default"; 5 | }; 6 | outputs = { self, nixpkgs, systems }: 7 | let 8 | inherit (nixpkgs) lib; 9 | eachSystem = lib.genAttrs (import systems); 10 | mkApp = program: { type = "app"; inherit program; }; 11 | in { 12 | packages = eachSystem (system: rec { 13 | waydroid_script = nixpkgs.legacyPackages."${system}".callPackage ./package.nix { }; 14 | default = waydroid_script; 15 | }); 16 | apps = eachSystem (system: rec { 17 | waydroid_script = mkApp "${self.outputs.packages.${system}.waydroid_script}/bin/waydroid_script"; 18 | default = waydroid_script; 19 | }); 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /package.nix: -------------------------------------------------------------------------------- 1 | { lib, 2 | stdenvNoCC, 3 | lzip, 4 | python3, 5 | makeWrapper }: 6 | let 7 | wrappedPath = lib.makeBinPath [ lzip ]; 8 | in stdenvNoCC.mkDerivation { 9 | name = "waydroid_script"; 10 | 11 | buildInputs = [ 12 | (python3.withPackages(ps: with ps; [ tqdm requests inquirerpy ])) 13 | ]; 14 | 15 | nativeBuildInputs = [ 16 | makeWrapper 17 | ]; 18 | 19 | src = ./.; 20 | 21 | postPatch = '' 22 | patchShebangs main.py 23 | ''; 24 | 25 | installPhase = '' 26 | mkdir -p $out/libexec 27 | cp -r . $out/libexec/waydroid_script 28 | mkdir -p $out/bin 29 | makeShellWrapper $out/libexec/waydroid_script/main.py $out/bin/waydroid_script \ 30 | --prefix PATH : "${wrappedPath}" 31 | ''; 32 | } 33 | -------------------------------------------------------------------------------- /stuff/hidestatusbar.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from stuff.general import General 4 | 5 | 6 | class HideStatusBar(General): 7 | id = "hide status bar" 8 | dl_links = {"11": ["https://github.com/ayasa520/hide-status-bar/releases/download/v0.0.2/app-release.apk", 9 | "ff2fe63ddfb4b035e6720a1b195b2355"]} 10 | partition = "system" 11 | dl_file_name = "hidestatusbar.apk" 12 | dl_link = ... 13 | act_md5 = ... 14 | files = [ 15 | "product/overlay/"+dl_file_name 16 | ] 17 | def __init__(self, android_version="11") -> None: 18 | super().__init__() 19 | self.dl_link = self.dl_links[android_version][0] 20 | self.act_md5 = self.dl_links[android_version][1] 21 | 22 | def copy(self): 23 | rro_dir = os.path.join( 24 | self.copy_dir, self.partition, "product", "overlay") 25 | if not os.path.exists(rro_dir): 26 | os.makedirs(rro_dir) 27 | shutil.copyfile(self.download_loc, os.path.join( 28 | rro_dir, "hidestatusbar.apk")) 29 | 30 | def skip_extract(self): 31 | return True 32 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "locked": { 5 | "lastModified": 1707650010, 6 | "narHash": "sha256-dOhphIA4MGrH4ElNCy/OlwmN24MsnEqFjRR6+RY7jZw=", 7 | "owner": "NixOS", 8 | "repo": "nixpkgs", 9 | "rev": "809cca784b9f72a5ad4b991e0e7bcf8890f9c3a6", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "id": "nixpkgs", 14 | "type": "indirect" 15 | } 16 | }, 17 | "root": { 18 | "inputs": { 19 | "nixpkgs": "nixpkgs", 20 | "systems": "systems" 21 | } 22 | }, 23 | "systems": { 24 | "locked": { 25 | "lastModified": 1681028828, 26 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 27 | "owner": "nix-systems", 28 | "repo": "default", 29 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 30 | "type": "github" 31 | }, 32 | "original": { 33 | "owner": "nix-systems", 34 | "repo": "default", 35 | "type": "github" 36 | } 37 | } 38 | }, 39 | "root": "root", 40 | "version": 7 41 | } 42 | -------------------------------------------------------------------------------- /stuff/mitm.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from stuff.general import General 4 | from tools.helper import run 5 | from tools.logger import Logger 6 | 7 | class Mitm(General): 8 | id = "mitm" 9 | partition = "system" 10 | 11 | def __init__(self, ca_cert_file: str=None) -> None: 12 | super().__init__() 13 | self.ca_cert_file = ca_cert_file 14 | 15 | def download(self): 16 | pass 17 | 18 | def skip_extract(self): 19 | return True 20 | 21 | def copy(self): 22 | file_hash = run([ 23 | 'openssl', 'x509', '-noout', '-subject_hash_old', '-in', 24 | self.ca_cert_file, 25 | ]).stdout.decode("ascii").strip() 26 | target_dir = os.path.join( 27 | self.copy_dir, self.partition, "etc", "security", "cacerts") 28 | Logger.info(f"Creating directory: {target_dir}") 29 | os.makedirs(target_dir, exist_ok=True) 30 | target_path = os.path.join(target_dir, f'{file_hash}.0') 31 | Logger.info(f"Copying {self.ca_cert_file} to system trust store") 32 | Logger.info(f"Target file: {target_path}") 33 | shutil.copyfile(self.ca_cert_file, target_path) 34 | os.chmod(target_path, 0o644) 35 | 36 | def install(self): 37 | if not self.ca_cert_file: 38 | raise ValueError( 39 | "This command requires the --ca-cert switch and a *.pem file") 40 | super().install() 41 | -------------------------------------------------------------------------------- /tools/images.py: -------------------------------------------------------------------------------- 1 | import configparser 2 | import os 3 | import subprocess 4 | import sys 5 | from tools.helper import run 6 | from tools.logger import Logger 7 | 8 | def mount(image, mount_point): 9 | umount(mount_point, False) 10 | if not os.path.exists(mount_point): 11 | os.makedirs(mount_point) 12 | run(["mount", "-o", "rw", image, mount_point]) 13 | 14 | def umount(mount_point, exists=True): 15 | if not os.path.exists(mount_point): 16 | if not exists: 17 | return 18 | Logger.error("{} does not exist!".format(mount_point)) 19 | raise FileNotFoundError() 20 | if not run(["mountpoint", mount_point]).returncode: 21 | run(["umount", mount_point]) 22 | else: 23 | Logger.warning("{} is not a mount point".format( 24 | mount_point)) 25 | 26 | def resize(img_file, size): 27 | run(["sudo", "e2fsck", "-y", "-f", img_file], ignore="^e2fsck \d+\.\d+\.\d (.+)\n$") 28 | run(["sudo", "resize2fs", img_file, size], ignore="^resize2fs \d+\.\d+\.\d (.+)\n$") 29 | 30 | def get_image_dir(): 31 | # Read waydroid config to get image location 32 | cfg = configparser.ConfigParser() 33 | cfg_file = os.environ.get("WAYDROID_CONFIG", "/var/lib/waydroid/waydroid.cfg") 34 | if not os.path.isfile(cfg_file): 35 | Logger.error("Cannot locate waydroid config file, reinit waydroid and try again!") 36 | sys.exit(1) 37 | cfg.read(cfg_file) 38 | if "waydroid" not in cfg: 39 | Logger.error("Required entry in config was not found, Cannot continue!") #magisk 40 | sys.exit(1) 41 | return cfg["waydroid"]["images_path"] 42 | -------------------------------------------------------------------------------- /stuff/fdroidpriv.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from stuff.general import General 4 | 5 | 6 | class FDroidPriv(General): 7 | id = "fdroid priv" 8 | dl_links = {"11": ["https://f-droid.org/repo/org.fdroid.fdroid.privileged.ota_2130.zip", 9 | "6242cab56d197d80c598593a46da62e4"], 10 | "13": ["https://f-droid.org/repo/org.fdroid.fdroid.privileged.ota_2130.zip", 11 | "6242cab56d197d80c598593a46da62e4"]} 12 | partition = "system" 13 | dl_file_name = "org.fdroid.fdroid.privileged.ota_2130.zip" 14 | dl_link = ... 15 | act_md5 = ... 16 | extract_to = "/tmp/fdroid_ota_2130" 17 | files = [ 18 | "app/F-Droid.apk" 19 | "app/F-Droid/F-Droid.apk" 20 | "etc/permissions/permissions_org.fdroid.fdroid.privileged.xml" 21 | "priv-app/F-DroidPrivilegedExtension.apk" 22 | "priv-app/F-DroidPrivilegedExtension/F-DroidPrivilegedExtension.apk" 23 | ] 24 | file_map = { 25 | "permissions_org.fdroid.fdroid.privileged.xml": "etc/permissions/permissions_org.fdroid.fdroid.privileged.xml", 26 | "F-Droid.apk": "app/F-Droid/F-Droid.apk", 27 | "F-DroidPrivilegedExtension.apk": "priv-app/F-DroidPrivilegedExtension/F-DroidPrivilegedExtension.apk", 28 | } 29 | def __init__(self, android_version="11") -> None: 30 | super().__init__() 31 | self.dl_link = self.dl_links[android_version][0] 32 | self.act_md5 = self.dl_links[android_version][1] 33 | 34 | def copy(self): 35 | for f, d in self.file_map.items(): 36 | rro_file = os.path.join( 37 | self.copy_dir, self.partition, d) 38 | rro_dir = os.path.dirname(rro_file) 39 | if not os.path.exists(rro_dir): 40 | os.makedirs(rro_dir) 41 | shutil.copyfile(os.path.join(self.extract_to, f), rro_file) 42 | 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | git 2 | # Byte-compiled / optimized / DLL files 3 | __pycache__/ 4 | *.py[cod] 5 | *$py.class 6 | 7 | # C extensions 8 | *.so 9 | *.out 10 | # Distribution / packaging 11 | .Python 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | .vscode 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | .hypothesis/ 50 | .pytest_cache/ 51 | 52 | # Translations 53 | *.mo 54 | *.pot 55 | 56 | # Django stuff: 57 | *.log 58 | local_settings.py 59 | db.sqlite3 60 | 61 | # Flask stuff: 62 | instance/ 63 | .webassets-cache 64 | 65 | # Scrapy stuff: 66 | .scrapy 67 | 68 | # Sphinx documentation 69 | docs/_build/ 70 | 71 | # PyBuilder 72 | target/ 73 | 74 | # Jupyter Notebook 75 | .ipynb_checkpoints 76 | 77 | # pyenv 78 | .python-version 79 | .idea/ 80 | # celery beat schedule file 81 | celerybeat-schedule 82 | workspace.xml 83 | # SageMath parsed files 84 | *.sage.py 85 | .idea/workspace.xml 86 | # Environments 87 | .env 88 | .venv 89 | env/ 90 | venv/ 91 | ENV/ 92 | env.bak/ 93 | venv.bak/ 94 | 95 | # Spyder project settings 96 | .spyderproject 97 | .spyproject 98 | 99 | # Rope project settings 100 | .ropeproject 101 | 102 | # mkdocs documentation 103 | /site 104 | 105 | # mypy 106 | .mypy_cache/ 107 | 108 | # nix 109 | result* 110 | 111 | test.py 112 | -------------------------------------------------------------------------------- /tools/container.py: -------------------------------------------------------------------------------- 1 | import configparser 2 | import os 3 | import sys 4 | # import dbus 5 | from tools.helper import run 6 | from tools.logger import Logger 7 | 8 | # def DBusContainerService(object_path="/ContainerManager", intf="id.waydro.ContainerManager"): 9 | # return dbus.Interface(dbus.SystemBus().get_object("id.waydro.Container", object_path), intf) 10 | 11 | # def DBusSessionService(object_path="/SessionManager", intf="id.waydro.SessionManager"): 12 | # return dbus.Interface(dbus.SessionBus().get_object("id.waydro.Session", object_path), intf) 13 | 14 | # def use_dbus(): 15 | # try: 16 | # DBusContainerService() 17 | # except: 18 | # return False 19 | # return True 20 | 21 | def use_overlayfs(): 22 | cfg = configparser.ConfigParser() 23 | cfg_file = os.environ.get("WAYDROID_CONFIG", "/var/lib/waydroid/waydroid.cfg") 24 | if not os.path.isfile(cfg_file): 25 | Logger.error("Cannot locate waydroid config file, reinit waydroid and try again!") 26 | sys.exit(1) 27 | cfg.read(cfg_file) 28 | if "waydroid" not in cfg: 29 | Logger.error("Required entry in config was not found, Cannot continue!") 30 | if "mount_overlays" not in cfg["waydroid"]: 31 | return False 32 | if cfg["waydroid"]["mount_overlays"]=="True": 33 | return True 34 | return False 35 | 36 | 37 | # def get_session(): 38 | # return DBusContainerService().GetSession() 39 | 40 | def stop(): 41 | # if use_dbus(): 42 | # session = DBusContainerService().GetSession() 43 | # if session: 44 | # DBusContainerService().Stop(False) 45 | # else: 46 | run(["waydroid", "container", "stop"]) 47 | 48 | 49 | def is_running(): 50 | return "Session:\tRUNNING" in run(["waydroid", "status"]).stdout.decode() 51 | 52 | def upgrade(): 53 | run(["waydroid", "upgrade", "-o"], ignore=r"\[.*\] Stopping container\n\[.*\] Starting container") 54 | -------------------------------------------------------------------------------- /stuff/ndk.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import shutil 4 | from stuff.general import General 5 | from tools.logger import Logger 6 | 7 | class Ndk(General): 8 | id = "libndk" 9 | partition = "system" 10 | dl_links = { 11 | "11": ["https://github.com/supremegamers/vendor_google_proprietary_ndk_translation-prebuilt/archive/9324a8914b649b885dad6f2bfd14a67e5d1520bf.zip", "c9572672d1045594448068079b34c350"], 12 | "13": ["https://github.com/supremegamers/vendor_google_proprietary_ndk_translation-prebuilt/archive/68734c52556d3d7a6db34c603dd9276915c29f2f.zip", "0b2207c490fcb400aa5c87fcf0d52d38"] 13 | } 14 | dl_file_name = "libndktranslation.zip" 15 | extract_to = "/tmp/libndkunpack" 16 | apply_props = { 17 | "ro.product.cpu.abilist": "x86_64,x86,arm64-v8a,armeabi-v7a,armeabi", 18 | "ro.product.cpu.abilist32": "x86,armeabi-v7a,armeabi", 19 | "ro.product.cpu.abilist64": "x86_64,arm64-v8a", 20 | "ro.dalvik.vm.native.bridge": "libndk_translation.so", 21 | "ro.enable.native.bridge.exec": "1", 22 | "ro.vendor.enable.native.bridge.exec": "1", 23 | "ro.vendor.enable.native.bridge.exec64": "1", 24 | "ro.ndk_translation.version": "0.2.3", 25 | "ro.dalvik.vm.isa.arm": "x86", 26 | "ro.dalvik.vm.isa.arm64": "x86_64" 27 | } 28 | files = [ 29 | "bin/arm", 30 | "bin/arm64", 31 | "bin/ndk_translation_program_runner_binfmt_misc", 32 | "bin/ndk_translation_program_runner_binfmt_misc_arm64", 33 | "etc/binfmt_misc", 34 | "etc/ld.config.arm.txt", 35 | "etc/ld.config.arm64.txt", 36 | "etc/init/ndk_translation.rc", 37 | "lib/arm", 38 | "lib64/arm64", 39 | "lib/libndk*", 40 | "lib64/libndk*" 41 | ] 42 | 43 | def __init__(self, android_version="11") -> None: 44 | super().__init__() 45 | self.dl_link = self.dl_links[android_version][0] 46 | self.act_md5 = self.dl_links[android_version][1] 47 | 48 | def copy(self): 49 | Logger.info("Copying libndk library files ...") 50 | name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0] 51 | shutil.copytree(os.path.join(self.extract_to, "vendor_google_proprietary_ndk_translation-prebuilt-" + name, 52 | "prebuilts"), os.path.join(self.copy_dir, self.partition), dirs_exist_ok=True) 53 | -------------------------------------------------------------------------------- /stuff/android_id.py: -------------------------------------------------------------------------------- 1 | from tools import container 2 | from tools.helper import shell 3 | from tools.logger import Logger 4 | import re 5 | 6 | class AndroidId: 7 | def get_id(self): 8 | if not container.is_running(): 9 | Logger.error("Please make sure Waydroid is running and Gapps has been installed!") 10 | return 11 | 12 | try: 13 | # Get list of user IDs and their names using 'pm list users' 14 | users_raw = shell( 15 | arg="pm list users", 16 | env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n" 17 | ) 18 | user_map = {} 19 | for line in users_raw.strip().splitlines(): 20 | match = re.search(r'UserInfo\{(\d+):([^:}]+)', line) 21 | if match: 22 | user_id, username = match.groups() 23 | user_map[user_id] = username 24 | except Exception as e: 25 | Logger.error(f"Failed to parse user list: {e}") 26 | return 27 | 28 | print("------------------------------------------------------------------------") 29 | print(f"{'Username':<20} | {'User ID':^10} | {'GSF Android ID'}") 30 | print("------------------------------------------------------------------------") 31 | 32 | for user_id, username in user_map.items(): 33 | try: 34 | db_path = f"/data/user/{user_id}/com.google.android.gsf/databases/gservices.db" 35 | query = f"sqlite3 {db_path} \"select value from main where name = 'android_id';\"" 36 | gsf_id = shell( 37 | arg=query, 38 | env="ANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n" 39 | ).strip() 40 | 41 | if gsf_id: 42 | print(f"{username:<20} | {user_id:^10} | {gsf_id}") 43 | else: 44 | print(f"{username:<20} | {user_id:^10} | (not found)") 45 | except: 46 | print(f"{username:<20} | {user_id:^10} | (query error)") 47 | 48 | print("------------------------------------------------------------------------") 49 | print(" ^----- Open https://google.com/android/uncertified/?pli=1") 50 | print(" Login with your Google ID, then submit the form with the ID(s) shown above.") 51 | 52 | -------------------------------------------------------------------------------- /stuff/widevine.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import shutil 4 | from stuff.general import General 5 | from tools.logger import Logger 6 | 7 | 8 | class Widevine(General): 9 | id = "widevine" 10 | partition = "vendor" 11 | dl_links = { 12 | # "x86": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/94c9ee172e3d78fecc81863f50a59e3646f7a2bd.zip", "a31f325453c5d239c21ecab8cfdbd878"], 13 | "x86_64": { 14 | "11": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/48d1076a570837be6cdce8252d5d143363e37cc1.zip", 15 | "f587b8859f9071da4bca6cea1b9bed6a"], 16 | "13": ["https://github.com/WayDroid-ATV/vendor_google_proprietary_widevine-prebuilt/archive/679552343d8b2e8d7a19b6df61c7a03963d0c75b.zip", 17 | "80ab79ea85c7b2556baedb371a54e01c"] 18 | }, 19 | # "armeabi-v7a": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", "fed6898b5cfd2a908cb134df97802554"], 20 | "arm64-v8a": { 21 | "11": ["https://github.com/supremegamers/vendor_google_proprietary_widevine-prebuilt/archive/a1a19361d36311bee042da8cf4ced798d2c76d98.zip", 22 | "fed6898b5cfd2a908cb134df97802554"] 23 | } 24 | } 25 | dl_file_name = "widevine.zip" 26 | extract_to = "/tmp/widevineunpack" 27 | files = [ 28 | "bin/hw/*widevine", 29 | "bin/move_widevine_data.sh", 30 | "etc/init/*widevine.rc", 31 | "etc/vintf/manifest/*widevine.xml", 32 | "lib/libwvhidl.so", 33 | "lib/libwvaidl.so", 34 | "lib/mediadrm", 35 | "lib64/libwvhidl.so", 36 | "lib64/libwvaidl.so", 37 | "lib64/mediadrm" 38 | ] 39 | 40 | def __init__(self, android_version) -> None: 41 | super().__init__() 42 | self.dl_link = self.dl_links[self.arch[0]][android_version][0] 43 | self.act_md5 = self.dl_links[self.arch[0]][android_version][1] 44 | self.android_version = android_version 45 | self.libdir = "lib64" if self.arch[1] == 64 else "lib" 46 | 47 | def copy(self): 48 | name = re.findall("([a-zA-Z0-9]+)\\.zip", self.dl_link)[0] 49 | Logger.info("Copying widevine library files ...") 50 | shutil.copytree(os.path.join(self.extract_to, "vendor_google_proprietary_widevine-prebuilt-"+name, 51 | "prebuilts"), os.path.join(self.copy_dir, self.partition), dirs_exist_ok=True) 52 | if self.android_version == "13": 53 | try: 54 | os.symlink("libprotobuf-cpp-lite-3.9.1.so", 55 | os.path.join(self.copy_dir, self.partition, self.libdir, "libprotobuf-cpp-lite.so")) 56 | except FileExistsError: 57 | pass 58 | -------------------------------------------------------------------------------- /stuff/nodataperm.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import shutil 4 | from stuff.general import General 5 | from tools.helper import backup, restore 6 | from tools.logger import Logger 7 | from tools import container 8 | 9 | 10 | class Nodataperm(General): 11 | id = "nodataperm" 12 | dl_links = { 13 | "11": { 14 | "x86_64": [ 15 | "https://github.com/ayasa520/hack_full_data_permission/archive/d4beab7780eb792059d33e77d865579c9ee41546.zip", 16 | "b0e3908ffcf5df8ea62f4929aa680f1a" 17 | ], 18 | }, 19 | "13": { 20 | "x86_64": [ 21 | "https://github.com/ayasa520/hack_full_data_permission/archive/d4beab7780eb792059d33e77d865579c9ee41546.zip", 22 | "b0e3908ffcf5df8ea62f4929aa680f1a" 23 | ], 24 | }, 25 | } 26 | dl_file_name = "nodataperm.zip" 27 | extract_to = "/tmp/nodataperm" 28 | dl_link = None 29 | act_md5 = None 30 | partition = "system" 31 | files = [ 32 | "etc/nodataperm.sh", 33 | "etc/init/nodataperm.rc", 34 | "framework/services.jar", 35 | "framework/services.jar.prof", 36 | "framework/services.jar.bprof", 37 | ] 38 | 39 | def __init__(self, android_version="11") -> None: 40 | super().__init__() 41 | print("ok") 42 | arch = self.arch[0] 43 | if android_version not in self.dl_links: 44 | raise KeyError(f"No download links for Android version '{android_version}'") 45 | if arch not in self.dl_links[android_version]: 46 | raise KeyError(f"No download links for architecture '{arch}' in Android version '{android_version}'") 47 | self.dl_link = self.dl_links[android_version][arch][0] 48 | self.act_md5 = self.dl_links[android_version][arch][1] 49 | 50 | def copy(self): 51 | name = re.findall(r"([a-zA-Z0-9]+)\.zip", self.dl_link)[0] 52 | extract_path = os.path.join( 53 | self.extract_to, f"hack_full_data_permission-{name}") 54 | if not container.use_overlayfs(): 55 | services_jar = os.path.join( 56 | self.copy_dir, self.partition, "framework", "services.jar") 57 | services_jar_prof = os.path.join( 58 | self.copy_dir, self.partition, "framework", "services.jar.prof") 59 | services_jar_bprof = os.path.join( 60 | self.copy_dir, self.partition, "framework", "services.jar.bprof") 61 | backup(services_jar) 62 | backup(services_jar_prof) 63 | backup(services_jar_bprof) 64 | 65 | Logger.info(f"Copying {self.id} library files ...") 66 | shutil.copytree(extract_path, os.path.join( 67 | self.copy_dir, self.partition), dirs_exist_ok=True) 68 | 69 | def extra2(self): 70 | if not container.use_overlayfs(): 71 | services_jar = os.path.join( 72 | self.copy_dir, self.partition, "framework", "services.jar") 73 | services_jar_prof = os.path.join( 74 | self.copy_dir, self.partition, "framework", "services.jar.prof") 75 | services_jar_bprof = os.path.join( 76 | self.copy_dir, self.partition, "framework", "services.jar.bprof") 77 | restore(services_jar) 78 | restore(services_jar_prof) 79 | restore(services_jar_bprof) 80 | -------------------------------------------------------------------------------- /stuff/houdini.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import shutil 4 | from stuff.general import General 5 | from tools.logger import Logger 6 | 7 | 8 | class Houdini(General): 9 | id = "libhoudini" 10 | partition = "system" 11 | dl_links = { 12 | "11": ["https://github.com/supremegamers/vendor_intel_proprietary_houdini/archive/81f2a51ef539a35aead396ab7fce2adf89f46e88.zip", "fbff756612b4144797fbc99eadcb6653"], 13 | "13": ["https://github.com/supremegamers/vendor_intel_proprietary_houdini/archive/7e21ea3f63bd89e9e8af54e32da41bd8b65c93a1.zip", "f8cf5db10e5fdb9b77e98e515a9b08c9"] 14 | } 15 | act_md5 = ... 16 | dl_link = ... 17 | dl_file_name = "libhoudini.zip" 18 | extract_to = "/tmp/houdiniunpack" 19 | init_rc_component = """ 20 | on early-init 21 | mount binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc 22 | 23 | on property:ro.enable.native.bridge.exec=1 24 | 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" 25 | 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" 26 | 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" 27 | 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" 28 | """ 29 | apply_props = { 30 | "ro.product.cpu.abilist": "x86_64,x86,arm64-v8a,armeabi-v7a,armeabi", 31 | "ro.product.cpu.abilist32": "x86,armeabi-v7a,armeabi", 32 | "ro.product.cpu.abilist64": "x86_64,arm64-v8a", 33 | "ro.dalvik.vm.native.bridge": "libhoudini.so", 34 | "ro.enable.native.bridge.exec": "1", 35 | "ro.dalvik.vm.isa.arm": "x86", 36 | "ro.dalvik.vm.isa.arm64": "x86_64" 37 | } 38 | files = [ 39 | "bin/arm", 40 | "bin/arm64", 41 | "bin/houdini", 42 | "bin/houdini64", 43 | "etc/binfmt_misc", 44 | "etc/init/houdini.rc", 45 | "lib/arm", 46 | "lib/libhoudini.so", 47 | "lib64/arm64", 48 | "lib64/libhoudini.so" 49 | ] 50 | 51 | def __init__(self, android_version="11") -> None: 52 | super().__init__() 53 | self.dl_link = self.dl_links[android_version][0] 54 | self.act_md5 = self.dl_links[android_version][1] 55 | 56 | def copy(self): 57 | Logger.info("Copying libhoudini library files ...") 58 | name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0] 59 | shutil.copytree(os.path.join(self.extract_to, "vendor_intel_proprietary_houdini-" + name, 60 | "prebuilts"), os.path.join(self.copy_dir, self.partition), dirs_exist_ok=True) 61 | init_path = os.path.join( 62 | self.copy_dir, self.partition, "etc", "init", "houdini.rc") 63 | if not os.path.isfile(init_path): 64 | os.makedirs(os.path.dirname(init_path), exist_ok=True) 65 | with open(init_path, "w") as initfile: 66 | initfile.write(self.init_rc_component) 67 | -------------------------------------------------------------------------------- /stuff/smartdock.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from stuff.general import General 4 | 5 | class Smartdock(General): 6 | id = "smartdock" 7 | dl_link = "https://f-droid.org/repo/cu.axel.smartdock_1141.apk" 8 | partition = "system" 9 | dl_file_name = "smartdock.apk" 10 | act_md5 = "988a51266e4ada5d6f72b1d857726360" 11 | apply_props = { "qemu.hw.mainkeys" : "1" } 12 | skip_extract = True 13 | permissions = """ 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | """ 38 | files = [ 39 | "etc/permissions/permissions_cu.axel.smartdock.xml", 40 | "priv-app/SmartDock", 41 | "etc/init/smartdock.rc" 42 | ] 43 | rc_content = ''' 44 | on property:sys.boot_completed=1 45 | start set_home_activity 46 | 47 | service set_home_activity /system/bin/sh -c "cmd package set-home-activity cu.axel.smartdock/.activities.LauncherActivity" 48 | user root 49 | group root 50 | oneshot 51 | ''' 52 | 53 | def copy(self): 54 | if not os.path.exists(os.path.join(self.copy_dir, self.partition, "priv-app", "SmartDock")): 55 | os.makedirs(os.path.join(self.copy_dir, self.partition, "priv-app", "SmartDock")) 56 | if not os.path.exists(os.path.join(self.copy_dir, self.partition, "etc", "permissions")): 57 | os.makedirs(os.path.join(self.copy_dir, self.partition, "etc", "permissions")) 58 | shutil.copyfile(os.path.join(self.download_loc), 59 | os.path.join(self.copy_dir, self.partition, "priv-app/SmartDock/smartdock.apk")) 60 | 61 | with open(os.path.join(self.copy_dir, self.partition, "etc", "permissions", "permissions_cu.axel.smartdock.xml"), "w") as f: 62 | f.write(self.permissions) 63 | 64 | rc_dir = os.path.join(self.copy_dir, self.partition, "etc/init/smartdock.rc") 65 | if not os.path.exists(os.path.dirname(rc_dir)): 66 | os.makedirs(os.path.dirname(rc_dir)) 67 | self.extract_app_lib(os.path.join(self.copy_dir, self.partition, "priv-app/SmartDock/smartdock.apk")) 68 | with open(rc_dir, "w") as f: 69 | f.write(self.rc_content) 70 | -------------------------------------------------------------------------------- /tools/helper.py: -------------------------------------------------------------------------------- 1 | import gzip 2 | import os 3 | import re 4 | import platform 5 | import re 6 | import subprocess 7 | import sys 8 | import requests 9 | from tools.logger import Logger 10 | from tqdm import tqdm 11 | import hashlib 12 | from typing import Optional 13 | 14 | 15 | def get_download_dir(): 16 | download_loc = "" 17 | if os.environ.get("XDG_CACHE_HOME", None) is None: 18 | download_loc = os.path.join('/', "home", os.environ.get( 19 | "SUDO_USER", os.environ["USER"]), ".cache", "waydroid-script", "downloads" 20 | ) 21 | else: 22 | download_loc = os.path.join( 23 | os.environ["XDG_CACHE_HOME"], "waydroid-script", "downloads" 24 | ) 25 | if not os.path.exists(download_loc): 26 | os.makedirs(download_loc) 27 | return download_loc 28 | 29 | # not good 30 | def get_data_dir(): 31 | return os.path.join('/', "home", os.environ.get("SUDO_USER", os.environ["USER"]), ".local", "share", "waydroid", "data") 32 | 33 | # execute on host 34 | def run(args: list, env: Optional[str] = None, ignore: Optional[str] = None): 35 | result = subprocess.run( 36 | args=args, 37 | env=env, 38 | stdout=subprocess.PIPE, 39 | stderr=subprocess.PIPE 40 | ) 41 | 42 | # print(result.stdout.decode()) 43 | if result.stderr: 44 | error = result.stderr.decode("utf-8") 45 | if ignore and re.match(ignore, error): 46 | return result 47 | Logger.error(error) 48 | raise subprocess.CalledProcessError( 49 | returncode=result.returncode, 50 | cmd=result.args, 51 | stderr=result.stderr 52 | ) 53 | return result 54 | 55 | # execute on waydroid shell 56 | def shell(arg: str, env: Optional[str] = None): 57 | a = subprocess.Popen( 58 | args=["sudo", "waydroid", "shell"], 59 | stdin=subprocess.PIPE, 60 | stdout=subprocess.PIPE, 61 | stderr=subprocess.PIPE 62 | ) 63 | subprocess.Popen( 64 | args=["echo", "export BOOTCLASSPATH=/apex/com.android.art/javalib/core-oj.jar:/apex/com.android.art/javalib/core-libart.jar:/apex/com.android.art/javalib/core-icu4j.jar:/apex/com.android.art/javalib/okhttp.jar:/apex/com.android.art/javalib/bouncycastle.jar:/apex/com.android.art/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/framework-atb-backward-compatibility.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar:/apex/com.android.mediaprovider/javalib/framework-mediaprovider.jar:/apex/com.android.os.statsd/javalib/framework-statsd.jar:/apex/com.android.permission/javalib/framework-permission.jar:/apex/com.android.sdkext/javalib/framework-sdkextensions.jar:/apex/com.android.wifi/javalib/framework-wifi.jar:/apex/com.android.tethering/javalib/framework-tethering.jar"], 65 | stdout=a.stdin, 66 | stdin=subprocess.PIPE 67 | ).communicate() 68 | 69 | if env: 70 | subprocess.Popen( 71 | args=["echo", env], 72 | stdout=a.stdin, 73 | stdin=subprocess.PIPE 74 | ).communicate() 75 | 76 | subprocess.Popen( 77 | args=["echo", arg], 78 | stdout=a.stdin, 79 | stdin=subprocess.PIPE 80 | ).communicate() 81 | 82 | a.stdin.close() 83 | if a.stderr.read(): 84 | Logger.error(a.stderr.read().decode('utf-8')) 85 | raise subprocess.CalledProcessError( 86 | returncode=a.returncode, 87 | cmd=a.args, 88 | stderr=a.stderr 89 | ) 90 | return a.stdout.read().decode("utf-8") 91 | 92 | def download_file(url, f_name): 93 | md5 = "" 94 | response = requests.get(url, stream=True) 95 | total_size_in_bytes = int(response.headers.get('content-length', 0)) 96 | block_size = 1024 # 1 Kibibyte 97 | progress_bar = tqdm(total=total_size_in_bytes, unit='iB', unit_scale=True) 98 | with open(f_name, 'wb') as file: 99 | for data in response.iter_content(block_size): 100 | progress_bar.update(len(data)) 101 | file.write(data) 102 | progress_bar.close() 103 | with open(f_name, "rb") as f: 104 | bytes = f.read() 105 | md5 = hashlib.md5(bytes).hexdigest() 106 | if total_size_in_bytes != 0 and progress_bar.n != total_size_in_bytes: 107 | raise ValueError("Something went wrong while downloading") 108 | return md5 109 | 110 | def host(): 111 | machine = platform.machine() 112 | 113 | mapping = { 114 | "i686": ("x86", 32), 115 | "x86_64": ("x86_64", 64), 116 | "aarch64": ("arm64-v8a", 64), 117 | "armv7l": ("armeabi-v7a", 32), 118 | "armv8l": ("armeabi-v7a", 32) 119 | } 120 | if machine in mapping: 121 | if mapping[machine] == "x86_64": 122 | with open("/proc/cpuinfo") as f: 123 | if "sse4_2" not in f.read(): 124 | Logger.warning("x86_64 CPU does not support SSE4.2, falling back to x86...") 125 | return ("x86", 32) 126 | return mapping[machine] 127 | raise ValueError("platform.machine '" + machine + "'" 128 | " architecture is not supported") 129 | 130 | 131 | def check_root(): 132 | if os.geteuid() != 0: 133 | Logger.error("This script must be run as root. Aborting.") 134 | sys.exit(1) 135 | 136 | def backup(path): 137 | gz_filename = path+".gz" 138 | with gzip.open(gz_filename, 'wb') as f_gz: 139 | with open(path, "rb") as f: 140 | f_gz.write(f.read()) 141 | 142 | def restore(path): 143 | gz_filename = path+".gz" 144 | with gzip.GzipFile(gz_filename) as f_gz: 145 | with open(path, "wb") as f: 146 | f.writelines(f_gz) 147 | -------------------------------------------------------------------------------- /stuff/magisk.py: -------------------------------------------------------------------------------- 1 | import gzip 2 | import os 3 | import shutil 4 | import re 5 | from stuff.general import General 6 | from tools.helper import download_file, get_data_dir, host 7 | from tools.logger import Logger 8 | from tools import container 9 | 10 | class Magisk(General): 11 | id = "magisk delta" 12 | partition = "system" 13 | dl_link = "https://github.com/mistrmochov/magiskdeltaorig/raw/main/app-release.apk" 14 | dl_file_name = "magisk.apk" 15 | extract_to = "/tmp/magisk_unpack" 16 | magisk_dir = os.path.join(partition, "etc", "init", "magisk") 17 | files = ["etc/init/magisk", "etc/init/bootanim.rc"] 18 | oringinal_bootanim = """ 19 | service bootanim /system/bin/bootanimation 20 | class core animation 21 | user graphics 22 | group graphics audio 23 | disabled 24 | oneshot 25 | ioprio rt 0 26 | task_profiles MaxPerformance 27 | 28 | """ 29 | bootanim_component = f""" 30 | on post-fs-data 31 | start logd 32 | exec u:r:su:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk 33 | exec u:r:magisk:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk 34 | exec u:r:update_engine:s0 root root -- /system/etc/init/magisk/magiskpolicy --live --magisk 35 | mkdir /dev/magisk_iqeoVo2mDrO 700 36 | exec u:r:su:s0 root root -- /system/etc/init/magisk/magisk64 --auto-selinux --setup-sbin /system/etc/init/magisk /dev/magisk_iqeoVo2mDrO 37 | exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --post-fs-data 38 | 39 | on nonencrypted 40 | exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --service 41 | 42 | on property:vold.decrypt=trigger_restart_framework 43 | exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --service 44 | 45 | on property:sys.boot_completed=1 46 | mkdir /data/adb/magisk 755 47 | exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --boot-complete 48 | 49 | on property:init.svc.zygote=restarting 50 | exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --zygote-restart 51 | 52 | on property:init.svc.zygote=stopped 53 | exec u:r:su:s0 root root -- /dev/magisk_iqeoVo2mDrO/magisk --auto-selinux --zygote-restart 54 | """ 55 | 56 | def download(self): 57 | if os.path.isfile(self.download_loc): 58 | os.remove(self.download_loc) 59 | Logger.info("Downloading latest Magisk-Delta to {} now ...".format(self.download_loc)) 60 | download_file(self.dl_link, self.download_loc) 61 | 62 | # require additional setup 63 | def setup(self): 64 | Logger.info("Additional setup") 65 | magisk_absolute_dir = os.path.join(self.copy_dir, self.magisk_dir) 66 | data_dir = get_data_dir() 67 | shutil.copytree(magisk_absolute_dir, os.path.join(data_dir, "adb", "magisk"), dirs_exist_ok=True) 68 | 69 | def copy(self): 70 | magisk_absolute_dir = os.path.join(self.copy_dir, self.magisk_dir) 71 | if not os.path.exists(magisk_absolute_dir): 72 | os.makedirs(magisk_absolute_dir, exist_ok=True) 73 | 74 | if not os.path.exists(os.path.join(self.copy_dir, "sbin")): 75 | os.makedirs(os.path.join(self.copy_dir, "sbin"), exist_ok=True) 76 | 77 | Logger.info("Copying magisk libs now ...") 78 | 79 | lib_dir = os.path.join(self.extract_to, "lib", self.arch[0]) 80 | for parent, dirnames, filenames in os.walk(lib_dir): 81 | for filename in filenames: 82 | o_path = os.path.join(lib_dir, filename) 83 | filename = re.search('lib(.*)\.so', filename) 84 | n_path = os.path.join(magisk_absolute_dir, filename.group(1)) 85 | shutil.copyfile(o_path, n_path) 86 | shutil.copyfile(self.download_loc, os.path.join(magisk_absolute_dir,"magisk.apk") ) 87 | shutil.copytree(os.path.join(self.extract_to, "assets", "chromeos"), os.path.join(magisk_absolute_dir, "chromeos"), dirs_exist_ok=True) 88 | assets_files = [ 89 | "addon.d.sh", 90 | "boot_patch.sh", 91 | "stub.apk", 92 | "util_functions.sh" 93 | ] 94 | for f in assets_files: 95 | shutil.copyfile(os.path.join(self.extract_to, "assets", f), os.path.join(magisk_absolute_dir, f)) 96 | 97 | # Updating Magisk from Magisk manager will modify bootanim.rc, 98 | # So it is necessary to backup the original bootanim.rc. 99 | bootanim_path = os.path.join(self.copy_dir, self.partition, "etc", "init", "bootanim.rc") 100 | gz_filename = os.path.join(bootanim_path)+".gz" 101 | with gzip.open(gz_filename,'wb') as f_gz: 102 | f_gz.write(self.oringinal_bootanim.encode('utf-8')) 103 | with open(bootanim_path, "w") as initfile: 104 | initfile.write(self.oringinal_bootanim+self.bootanim_component) 105 | 106 | def set_path_perm(self, path): 107 | if "magisk" in path.split("/"): 108 | perms = [0, 2000, 0o755, 0o755] 109 | else: 110 | perms = [0, 0, 0o755, 0o644] 111 | 112 | mode = os.stat(path).st_mode 113 | 114 | if os.path.isdir(path): 115 | mode |= perms[2] 116 | else: 117 | mode |= perms[3] 118 | 119 | os.chown(path, perms[0], perms[1]) 120 | os.chmod(path, mode) 121 | 122 | def extra1(self): 123 | self.delete_upper() 124 | self.setup() 125 | 126 | # Delete the contents of upperdir 127 | def delete_upper(self): 128 | if container.use_overlayfs(): 129 | sys_overlay_rw = "/var/lib/waydroid/overlay_rw" 130 | files = [ 131 | "system/system/etc/init/bootanim.rc", 132 | "system/system/etc/init/bootanim.rc.gz", 133 | "system/system/etc/init/magisk", 134 | "system/system/addon.d/99-magisk.sh", 135 | "vendor/etc/selinux/precompiled_sepolicy" 136 | ] 137 | 138 | for f in files: 139 | file = os.path.join(sys_overlay_rw, f) 140 | if os.path.isdir(file): 141 | shutil.rmtree(file) 142 | elif os.path.isfile(file) or os.path.exists(file): 143 | os.remove(file) 144 | 145 | def extra2(self): 146 | self.delete_upper() 147 | data_dir = get_data_dir() 148 | files = [ 149 | os.path.join(data_dir, "adb/magisk.db"), 150 | os.path.join(data_dir, "adb/magisk") 151 | ] 152 | for file in files: 153 | if os.path.isdir(file): 154 | shutil.rmtree(file) 155 | elif os.path.isfile(file): 156 | os.remove(file) 157 | bootanim_path = os.path.join(self.copy_dir, self.partition, "etc", "init", "bootanim.rc") 158 | if container.use_overlayfs(): 159 | if os.path.exists(bootanim_path): 160 | os.remove(bootanim_path) 161 | else: 162 | with open(bootanim_path, "w") as initfile: 163 | initfile.write(self.oringinal_bootanim) 164 | -------------------------------------------------------------------------------- /stuff/general.py: -------------------------------------------------------------------------------- 1 | import configparser 2 | import glob 3 | import os 4 | import shutil 5 | import zipfile 6 | import hashlib 7 | from tools.helper import download_file, get_download_dir, host 8 | from tools import container 9 | from tools.logger import Logger 10 | 11 | 12 | class General: 13 | files = [] 14 | 15 | @property 16 | def arch(self): 17 | return host() 18 | 19 | @property 20 | def skip_extract(self): 21 | return False 22 | 23 | @property 24 | def download_loc(self): 25 | return os.path.join(get_download_dir(), self.dl_file_name) 26 | 27 | @property 28 | def copy_dir(self): 29 | if container.use_overlayfs(): 30 | return "/var/lib/waydroid/overlay" 31 | else: 32 | return "/tmp/waydroid" 33 | 34 | def download(self): 35 | Logger.info("Downloading {} now to {} .....".format( 36 | self.dl_file_name, self.download_loc)) 37 | loc_md5 = "" 38 | if os.path.isfile(self.download_loc): 39 | with open(self.download_loc, "rb") as f: 40 | bytes = f.read() 41 | loc_md5 = hashlib.md5(bytes).hexdigest() 42 | while not os.path.isfile(self.download_loc) or loc_md5 != self.act_md5: 43 | if os.path.isfile(self.download_loc): 44 | os.remove(self.download_loc) 45 | Logger.warning( 46 | "md5 mismatches, redownloading now ....") 47 | loc_md5 = download_file(self.dl_link, self.download_loc) 48 | 49 | def remove(self): 50 | for f in self.files: 51 | file = os.path.join(self.copy_dir, self.partition, f) 52 | if "*" in file: 53 | for wildcard_file in glob.glob(file): 54 | if os.path.isdir(wildcard_file): 55 | shutil.rmtree(wildcard_file) 56 | elif os.path.isfile(wildcard_file): 57 | os.remove(wildcard_file) 58 | else: 59 | if os.path.isdir(file): 60 | shutil.rmtree(file) 61 | elif os.path.isfile(file): 62 | os.remove(file) 63 | 64 | def extract(self): 65 | Logger.info(f"Extracting {self.download_loc} to {self.extract_to}") 66 | with zipfile.ZipFile(self.download_loc) as z: 67 | z.extractall(self.extract_to) 68 | 69 | def add_props(self): 70 | bin_dir = os.path.join(self.copy_dir, "system", "etc") 71 | resetprop_rc = os.path.join( 72 | self.copy_dir, "system/etc/init/resetprop.rc") 73 | if not os.path.isfile(os.path.join(bin_dir, "resetprop")): 74 | if not os.path.exists(bin_dir): 75 | os.makedirs(bin_dir) 76 | shutil.copy(os.path.join(os.path.join(os.path.dirname(__file__), "..", "bin", 77 | self.arch[0], "resetprop")), bin_dir) 78 | os.chmod(os.path.join(bin_dir, "resetprop"), 0o755) 79 | if not os.path.isfile(os.path.join(bin_dir, "resetprop.sh")): 80 | with open(os.path.join(bin_dir, "resetprop.sh"), "w") as f: 81 | f.write("#!/system/bin/sh\n") 82 | f.write( 83 | "while read line; do /system/etc/resetprop ${line%=*} ${line#*=}; done < /vendor/waydroid.prop\n") 84 | os.chmod(os.path.join(bin_dir, "resetprop.sh"), 0o755) 85 | if not os.path.isfile(resetprop_rc): 86 | if not os.path.exists(os.path.dirname(resetprop_rc)): 87 | os.makedirs(os.path.dirname(resetprop_rc)) 88 | with open(resetprop_rc, "w") as f: 89 | f.write( 90 | "on post-fs-data\n exec u:r:su:s0 root root -- /system/bin/sh /system/bin/resetprop.sh") 91 | os.chmod(resetprop_rc, 0o644) 92 | 93 | cfg = configparser.ConfigParser() 94 | cfg.read("/var/lib/waydroid/waydroid.cfg") 95 | 96 | for key in self.apply_props.keys(): 97 | if self.apply_props[key]: 98 | cfg.set('properties', key, self.apply_props[key]) 99 | 100 | with open("/var/lib/waydroid/waydroid.cfg", "w") as f: 101 | cfg.write(f) 102 | 103 | def extract_app_lib(self, apk_file_path): 104 | lib_dest_dir = os.path.dirname(apk_file_path) 105 | with zipfile.ZipFile(apk_file_path, "r") as apk: 106 | for file_info in apk.infolist(): 107 | file_name = file_info.filename 108 | file_path = os.path.join(lib_dest_dir, file_name) 109 | if file_info.filename.startswith(f"lib/{self.arch[0]}/") and file_name.endswith(".so"): 110 | os.makedirs(os.path.dirname( 111 | file_path), exist_ok=True) 112 | with apk.open(file_info.filename) as src_file, open(file_path, "wb") as dest_file: 113 | # Logger.info(f"{src_file} -> {dest_file}") 114 | shutil.copyfileobj(src_file, dest_file) 115 | 116 | def set_path_perm(self, path): 117 | if "bin" in path.split("/"): 118 | perms = [0, 2000, 0o755, 0o777] 119 | else: 120 | perms = [0, 0, 0o755, 0o644] 121 | 122 | mode = os.stat(path).st_mode 123 | 124 | if os.path.isdir(path): 125 | mode |= perms[2] 126 | else: 127 | mode |= perms[3] 128 | 129 | os.chown(path, perms[0], perms[1]) 130 | os.chmod(path, mode) 131 | 132 | def set_perm2(self, path, recursive=False): 133 | if not os.path.exists(path): 134 | return 135 | 136 | if recursive and os.path.isdir(path): 137 | for root, dirs, files in os.walk(path): 138 | for dir in dirs: 139 | self.set_path_perm(os.path.join(root, dir)) 140 | for file in files: 141 | self.set_path_perm(os.path.join(root, file)) 142 | else: 143 | self.set_path_perm(path) 144 | 145 | def set_perm(self): 146 | for f in self.files: 147 | path = os.path.join(self.copy_dir, self.partition, f) 148 | if "*" in path: 149 | for wildcard_file in glob.glob(path): 150 | self.set_perm2(wildcard_file, recursive=True) 151 | else: 152 | self.set_perm2(path, recursive=True) 153 | 154 | def remove_props(self): 155 | cfg = configparser.ConfigParser() 156 | cfg.read("/var/lib/waydroid/waydroid.cfg") 157 | 158 | for key in self.apply_props.keys(): 159 | cfg.remove_option('properties', key) 160 | 161 | with open("/var/lib/waydroid/waydroid.cfg", "w") as f: 162 | cfg.write(f) 163 | 164 | def copy(self): 165 | pass 166 | 167 | def extra1(self): 168 | pass 169 | 170 | def extra2(self): 171 | pass 172 | 173 | def install(self): 174 | self.download() 175 | if not self.skip_extract: 176 | self.extract() 177 | self.copy() 178 | self.extra1() 179 | if hasattr(self, "apply_props"): 180 | self.add_props() 181 | self.set_perm() 182 | Logger.info(f"{self.id} installation finished") 183 | 184 | def uninstall(self): 185 | self.remove() 186 | if hasattr(self, "apply_props"): 187 | self.remove_props() 188 | self.extra2() 189 | self.set_perm() 190 | Logger.info("Uninstallation finished") 191 | -------------------------------------------------------------------------------- /stuff/microg.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from stuff.general import General 4 | from tools.logger import Logger 5 | 6 | 7 | class MicroG(General): 8 | id = "MicroG" 9 | partition = "system" 10 | fdroid_repo_apks = { 11 | "com.aurora.store_41.apk": "9e6c79aefde3f0bbfedf671a2d73d1be", 12 | "com.etesync.syncadapter_20300.apk": "997d6de7d41c454d39fc22cd7d8fc3c2", 13 | "com.aurora.adroid_8.apk": "0010bf93f02c2d18daf9e767035fefc5", 14 | "org.fdroid.fdroid.privileged_2130.apk": "b04353155aceb36207a206d6dd14ba6a", 15 | "org.microg.nlp.backend.ichnaea_20036.apk": "0b3cb65f8458d1a5802737c7392df903", 16 | "org.microg.nlp.backend.nominatim_20042.apk": "88e7397cbb9e5c71c8687d3681a23383", 17 | } 18 | microg_apks= { 19 | "com.google.android.gms-223616054.apk": "a945481ca5d33a03bc0f9418263c3228", 20 | "com.google.android.gsf-8.apk": "b2b4ea3642df6158e14689a4b2a246d4", 21 | "com.android.vending-22.apk": "6815d191433ffcd8fa65923d5b0b0573", 22 | "org.microg.gms.droidguard-14.apk": "4734b41c1a6bc34a541053ddde7a0f8e" 23 | } 24 | priv_apps = ["com.google.android.gms", "com.android.vending"] 25 | dl_links = { 26 | "Standard": [ 27 | "https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-Standard-2.11.1-20230429100529.zip", 28 | "0fe332a9caa3fbb294f2e2b50f720c6b" 29 | ], 30 | "NoGoolag": [ 31 | "https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-NoGoolag-2.11.1-20230429100545.zip", 32 | "ff920f33f4c874eeae4c0444be427c68" 33 | ], 34 | "UNLP": [ 35 | "https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-UNLP-2.11.1-20230429100555.zip", 36 | "6136b383153c2a6797d14fb4d7ca3f97" 37 | ], 38 | "Minimal": [ 39 | "https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-Minimal-2.11.1-20230429100521.zip", 40 | "afb87eb64e7749cfd72c4760d85849da" 41 | ], 42 | "MinimalIAP": [ 43 | "https://github.com/ayasa520/MinMicroG/releases/download/latest/MinMicroG-MinimalIAP-2.11.1-20230429100556.zip", 44 | "cc071f4f776cbc16c4c1f707aff1f7fa" 45 | ] 46 | } 47 | dl_link = ... 48 | act_md5 = ... 49 | dl_file_name = ... 50 | sdk = ... 51 | extract_to = "/tmp/microg/extract" 52 | rc_content = ''' 53 | on property:sys.boot_completed=1 54 | start microg_service 55 | 56 | service microg_service /system/bin/sh /system/bin/npem 57 | user root 58 | group root 59 | oneshot 60 | ''' 61 | files = [ 62 | "priv-app/GoogleBackupTransport", 63 | "priv-app/MicroGUNLP", 64 | "priv-app/MicroGGMSCore", 65 | "priv-app/MicroGGMSCore/lib/x86_64/libmapbox-gl.so", 66 | "priv-app/MicroGGMSCore/lib/x86_64/libconscrypt_gmscore_jni.so", 67 | "priv-app/MicroGGMSCore/lib/x86_64/libcronet.102.0.5005.125.so", 68 | "priv-app/PatchPhonesky", 69 | "priv-app/PatchPhonesky/lib/x86_64/libempty_x86_64.so", 70 | "priv-app/AuroraServices", 71 | "bin/npem", 72 | "app/GoogleCalendarSyncAdapter", 73 | "app/NominatimNLPBackend", 74 | "app/MicroGGSFProxy", 75 | "app/LocalGSMNLPBackend", 76 | "app/DejaVuNLPBackend", 77 | "app/MozillaUnifiedNLPBackend", 78 | "app/AppleNLPBackend", 79 | "app/AuroraDroid", 80 | "app/LocalWiFiNLPBackend", 81 | "app/GoogleContactsSyncAdapter", 82 | "app/MicroGGSFProxy/MicroGGSFProxy", 83 | "framework/com.google.widevine.software.drm.jar", 84 | "framework/com.google.android.media.effects.jar", 85 | "framework/com.google.android.maps.jar", 86 | "lib64/libjni_keyboarddecoder.so", 87 | "lib64/libjni_latinimegoogle.so", 88 | "etc/default-permissions/microg-permissions.xml", 89 | "etc/default-permissions/microg-permissions-unlp.xml", 90 | "etc/default-permissions/gsync.xml", 91 | "etc/sysconfig/nogoolag.xml", 92 | "etc/sysconfig/nogoolag-unlp.xml", 93 | "etc/init/microg.rc", 94 | "etc/permissions/com.google.android.backuptransport.xml", 95 | "etc/permissions/com.android.vending.xml", 96 | "etc/permissions/foss-permissions.xml", 97 | "etc/permissions/com.google.android.gms.xml", 98 | "etc/permissions/com.aurora.services.xml", 99 | "etc/permissions/com.google.android.maps.xml", 100 | "etc/permissions/com.google.widevine.software.drm.xml", 101 | "etc/permissions/com.google.android.media.effects.xml", 102 | "lib/libjni_keyboarddecoder.so", 103 | "lib/libjni_latinimegoogle.so", 104 | ] 105 | 106 | def __init__(self, android_version="11", variant="Standard") -> None: 107 | super().__init__() 108 | self.dl_link = self.dl_links[variant][0] 109 | self.act_md5 = self.dl_links[variant][1] 110 | self.id = self.id+f"-{variant}" 111 | self.dl_file_name = f'MinMicroG-{variant}.zip' 112 | if android_version == "11": 113 | self.sdk = 30 114 | elif android_version == "13": 115 | self.sdk = 33 116 | 117 | def copy(self): 118 | Logger.info("Copying libs and apks...") 119 | dst_dir = os.path.join(self.copy_dir, self.partition) 120 | src_dir = os.path.join(self.extract_to, "system") 121 | if "arm" in self.arch[0]: 122 | sub_arch = "arm" 123 | else: 124 | sub_arch = "x86" 125 | if 64 == self.arch[1]: 126 | arch = f"{sub_arch}{'' if sub_arch=='arm' else '_'}64" 127 | for root, dirs, files in os.walk(src_dir): 128 | flag = False 129 | dir_name = os.path.basename(root) 130 | # 遍历文件 131 | if dir_name.startswith('-') and dir_name.endswith('-'): 132 | archs, sdks = [], [] 133 | for i in dir_name.split("-"): 134 | if i.isdigit(): 135 | sdks.append(i) 136 | elif i: 137 | archs.append(i) 138 | if len(archs) != 0 and arch not in archs and sub_arch not in archs or len(sdks) != 0 and str(self.sdk) not in sdks: 139 | continue 140 | else: 141 | flag = True 142 | 143 | for file in files: 144 | src_file_path = os.path.join(root, file) 145 | if not flag: 146 | dst_file_path = os.path.join(dst_dir, os.path.relpath( 147 | src_file_path, src_dir)) 148 | else: 149 | dst_file_path = os.path.join(dst_dir, os.path.relpath( 150 | os.path.join(os.path.dirname(root), file), src_dir)) 151 | if not os.path.exists(os.path.dirname(dst_file_path)): 152 | os.makedirs(os.path.dirname(dst_file_path)) 153 | # Logger.info(f"{src_file_path} -> {dst_file_path}") 154 | shutil.copy2(src_file_path, dst_file_path) 155 | if os.path.splitext(dst_file_path)[1].lower() == ".apk": 156 | self.extract_app_lib(dst_file_path) 157 | 158 | rc_dir = os.path.join(dst_dir, "etc/init/microg.rc") 159 | if not os.path.exists(os.path.dirname(rc_dir)): 160 | os.makedirs(os.path.dirname(rc_dir)) 161 | with open(rc_dir, "w") as f: 162 | f.write(self.rc_content) 163 | 164 | def extra2(self): 165 | system_dir = os.path.join(self.copy_dir, self.partition) 166 | files = [key.split("_")[0] for key in self.fdroid_repo_apks.keys()] 167 | files += [key.split("-")[0] for key in self.microg_apks.keys()] 168 | for f in files: 169 | if f in self.priv_apps: 170 | file = os.path.join(system_dir, "priv-app", f) 171 | else: 172 | file = os.path.join(system_dir, "app", f) 173 | if os.path.isdir(file): 174 | shutil.rmtree(file) 175 | elif os.path.isfile(file): 176 | os.remove(file) 177 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Waydroid Extras Script 2 | 3 | Script to add GApps and other stuff to Waydroid! 4 | 5 | # Installation/Usage 6 | 7 | ## Interactive terminal interface 8 | 9 | ``` 10 | git clone --depth 1 --single-branch https://github.com/huakim/waydroid_script 11 | cd waydroid_script 12 | python3 -m venv venv 13 | venv/bin/pip install -r requirements.txt 14 | sudo venv/bin/python3 main.py 15 | ``` 16 | 17 | ![image-20230430013103883](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/img/README/image-20230430013103883.png) 18 | 19 | ![image-20230430013119763](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/img/README/image-20230430013119763.png) 20 | 21 | ![image-20230430013148814](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main//assets/img/README/image-20230430013148814.png) 22 | 23 | 24 | ## Command Line 25 | 26 | ```bash 27 | git clone --depth 1 --single-branch https://github.com/huakim/waydroid_script 28 | cd waydroid_script 29 | venv/bin/python3 -m venv venv 30 | venv/bin/pip install -r requirements.txt 31 | # install something 32 | sudo venv/bin/python3 main.py install {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg, mitm} 33 | # uninstall something 34 | sudo venv/bin/python3 main.py uninstall {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg} 35 | # get Android device ID 36 | sudo venv/bin/python3 main.py certified 37 | # some hacks 38 | sudo venv/bin/python3 main.py hack {nodataperm, hidestatusbar} 39 | ``` 40 | 41 | ## Dependencies 42 | 43 | "lzip" is required for this script to work, install it using your distribution's package manager: 44 | ### openSUSE, Gecko based distributions: 45 | sudo zypper install lzip 46 | ### RHEL, Fedora and Rocky based distributions: 47 | sudo dnf install lzip 48 | ### Arch, Manjaro and EndeavourOS based distributions: 49 | sudo pacman -S lzip 50 | ### Debian and Ubuntu based distributions: 51 | sudo apt install lzip 52 | 53 | ## Install OpenGapps 54 | 55 | ![](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/1.png) 56 | 57 | Open terminal and switch to the directory where "main.py" is located then run: 58 | 59 | sudo venv/bin/python3 main.py install gapps 60 | 61 | Then launch waydroid with: 62 | 63 | waydroid show-full-ui 64 | 65 | After waydroid has finished booting, open terminal and switch to directory where "main.py" is located then run: 66 | 67 | sudo venv/bin/python3 main.py certified 68 | Copy the returned numeric ID, then open ["https://google.com/android/uncertified/?pli=1"](https://google.com/android/uncertified/?pli=1). Enter the ID and register it. Wait 10-20 minutes for device to get registered. Then clear Google Play Service's cache and try logging in! 69 | 70 | 71 | ## Install Magisk 72 | 73 | ![](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/2.png) 74 | 75 | Open terminal and switch to directory where "main.py" is located then run: 76 | 77 | sudo venv/bin/python3 main.py install magisk 78 | 79 | Magisk will be installed on next boot! 80 | 81 | Zygisk and modules like LSPosed should work now. 82 | 83 | If you want to update Magisk, Please use `Direct Install into system partition` or run this script again. 84 | 85 | This script only focuses on Magisk installation, if you need more management, please check https://github.com/nitanmarcel/waydroid-magisk 86 | 87 | ## Install libndk arm translation 88 | 89 | libndk_translation from guybrush firmware. 90 | 91 | libndk seems to have better performance than libhoudini on AMD. 92 | 93 | Open terminal and switch to directory where "main.py" is located then run: 94 | 95 | sudo venv/bin/python3 main.py install libndk 96 | 97 | ## Install libhoudini arm translation 98 | 99 | Intel's libhoudini for intel/AMD x86 CPU, pulled from Microsoft's WSA 11 image 100 | 101 | houdini version: 11.0.1b_y.38765.m 102 | 103 | houdini64 version: 11.0.1b_z.38765.m 104 | 105 | Open terminal and switch to directory where "main.py" is located then run: 106 | 107 | sudo venv/bin/python3 main.py install libhoudini 108 | 109 | ## Integrate Widevine DRM (L3) 110 | 111 | ![](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/3.png) 112 | 113 | Open terminal and switch to directory where "main.py" is located then run: 114 | 115 | sudo venv/bin/python3 main.py install widevine 116 | 117 | ## Install Smart Dock 118 | 119 | ![](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/4.png) 120 | ![](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/5.png) 121 | 122 | Open terminal and switch to directory where "main.py" is located then run: 123 | 124 | sudo venv/bin/python3 main.py install smartdock 125 | 126 | ## Install a self-signed CA certificate 127 | 128 | Open terminal and switch to directory where "main.py" is located then run: 129 | 130 | sudo venv/bin/python3 main.py install mitm --ca-cert mycert.pem 131 | 132 | ## Granting full permission for apps data (HACK) 133 | 134 | 135 | This is a temporary hack to combat against the apps permission issue on Android 11. Whenever an app is open it will always enable a property (persist.sys.nodataperm) to make it execute a script to grant the data full permissions (777). The **correct** way is to use `sdcardfs` or `esdfs`, both need to recompile the kernel or WayDroid image. 136 | 137 | Arknights, PUNISHING: GRAY RAVEN and other games won't freeze on the black screen. 138 | 139 | ![](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/6.png) 140 | 141 | Open terminal and switch to directory where "main.py" is located then run: 142 | 143 | ``` 144 | sudo venv/bin/python3 main.py hack nodataperm 145 | ``` 146 | **WARNING**: Tested on `lineage-18.1-20230128-VANILLA-waydroid_x86_64.img`. This script will replace `/system/framework/service.jar`, which may prevent WayDroid from booting. If so, run `sudo venv/bin/python3 main.py uninstall nodataperm` to remove it. 147 | 148 | 149 | Or you can run the following commands directly in `sudo waydroid shell`. In this way, every time a new game is installed, you need to run it again, but it's much less risky. 150 | 151 | ``` 152 | chmod 777 -R /sdcard/Android 153 | chmod 777 -R /data/media/0/Android 154 | chmod 777 -R /sdcard/Android/data 155 | chmod 777 -R /data/media/0/Android/obb 156 | chmod 777 -R /mnt/*/*/*/*/Android/data 157 | chmod 777 -R /mnt/*/*/*/*/Android/obb 158 | ``` 159 | 160 | - https://github.com/supremegamers/device_generic_common/commit/2d47891376c96011b2ee3c1ccef61cb48e15aed6 161 | - https://github.com/supremegamers/android_frameworks_base/commit/24a08bf800b2e461356a9d67d04572bb10b0e819 162 | 163 | ## Install microG, Aurora Store and Aurora Droid 164 | 165 | ![](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/7.png) 166 | 167 | ``` 168 | sudo venv/bin/python3 main.py install microg 169 | ``` 170 | 171 | ## Hide Status Bar 172 | Before 173 | ![Before](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/8.png) 174 | 175 | After 176 | ![After](https://raw.githubusercontent.com/huakim/waydroid_script_assets/main/assets/9.png) 177 | 178 | ``` 179 | sudo venv/bin/python3 main.py hack hidestatusbar 180 | ``` 181 | 182 | 183 | ## Get Android ID for device registration 184 | 185 | You need to register you device with its it before being able to use gapps, this will print out your Android ID which you can use for device registration required for Google apps: 186 | Open terminal and switch to directory where "main.py" is located then run: 187 | 188 | sudo python3 main.py certified 189 | 190 | Star this repository if you find this useful, if you encounter problem create an issue on GitHub! 191 | 192 | ## Error handling 193 | 194 | - Magisk installed: N/A 195 | 196 | Check [waydroid-magisk](https://github.com/nitanmarcel/waydroid-magisk) 197 | 198 | ## Credits 199 | - [WayDroid](https://github.com/waydroid/waydroid) 200 | - [Magisk Delta](https://huskydg.github.io/magisk-files/) 201 | - [microG Project](https://microg.org) 202 | - [Open GApps](https://opengapps.org) 203 | - [Smart Dock](https://github.com/axel358/smartdock) 204 | - [wd-scripts](https://github.com/electrikjesus/wd-scripts/) 205 | -------------------------------------------------------------------------------- /stuff/gps.py: -------------------------------------------------------------------------------- 1 | import os 2 | from xml.dom import minidom 3 | import xml.etree.ElementTree as ET 4 | import shutil 5 | from stuff.general import General 6 | from tools.logger import Logger 7 | import tools.images as images 8 | from tools.helper import run, host 9 | from tools import container 10 | 11 | class GPS(General): 12 | id = "gps" 13 | partition = "vendor" 14 | dl_links = ["https://github.com/Lolmc0587/android_gps_libraries/archive/refs/tags/2.1.zip","f84c369c7cebd9dbb8987ca15c6aa856"] 15 | act_md5 = ... 16 | dl_link = ... 17 | dl_file_name = "android_gps_libraries-2.1.zip" 18 | extract_to = "/tmp/android_gps_libraries-2.1" 19 | 20 | files = [ 21 | "lib/hw/android.hardware.gnss@1.0-impl.so", 22 | "lib64/hw/android.hardware.gnss@1.0-impl.so", 23 | "lib/hw/gps.default.so", 24 | "lib64/hw/gps.default.so", 25 | "etc/init/android.hardware.gnss@1.0-service.rc", 26 | ] 27 | 28 | 29 | def __init__(self, android_version="11", gps_host="/dev/ttyGPSD", baud_rate=9600) -> None: 30 | super().__init__() 31 | self.host_arch = host() 32 | # Set for arm 32 bit support from file downloaded 33 | self.host = "arm64-v8a" if "arm" in self.host_arch[0] else self.host_arch[0] 34 | self.gps_host = gps_host 35 | self.baud_rate = baud_rate 36 | self.android_version = android_version 37 | self.usb_name = self.gps_host.split("/")[-1] 38 | self.files_vendor = [ 39 | "bin/hw/android.hardware.gnss@1.0-service", 40 | ] 41 | self.config_files = { 42 | "11": [ 43 | "etc/vintf/compatibility_matrix.legacy.xml", 44 | "etc/vintf/manifest.xml", 45 | "build.prop", 46 | ], 47 | "13": [ 48 | "etc/vintf/compatibility_matrix.7.xml", 49 | "etc/vintf/manifest.xml", 50 | "build.prop", 51 | ], 52 | } 53 | 54 | self.compatibility_files = { 55 | "11": "etc/vintf/compatibility_matrix.legacy.xml", 56 | "13": "etc/vintf/compatibility_matrix.7.xml", 57 | } 58 | 59 | self.dl_link = self.dl_links[0] 60 | self.act_md5 = self.dl_links[1] 61 | 62 | def update_manifest(self, manifest_path, data): 63 | """ 64 | Update the manifest file by inserting data into the tag and format the XML. 65 | """ 66 | tree = ET.parse(manifest_path) 67 | root = tree.getroot() 68 | 69 | root.append(ET.fromstring(data)) 70 | tree.write(manifest_path, encoding="utf-8", xml_declaration=True) 71 | 72 | with open(manifest_path, "r") as f: 73 | content = f.read() 74 | formatted_content = minidom.parseString(content).toprettyxml(indent=" ") 75 | 76 | formatted_content = "\n".join( 77 | [line for line in formatted_content.split("\n") if line.strip()] 78 | ) 79 | 80 | with open(manifest_path, "w") as f: 81 | f.write(formatted_content) 82 | 83 | def copy(self): 84 | Logger.info("Copying gps library files ...") 85 | if self.android_version == "11": 86 | shutil.copytree(os.path.join(self.extract_to, self.dl_file_name.replace(".zip", ""), self.android_version, 87 | self.host, "system"), os.path.join(self.copy_dir, "system"), dirs_exist_ok=True) 88 | self.partition = "system" 89 | if self.android_version == "13": 90 | shutil.copytree(os.path.join(self.extract_to, self.dl_file_name.replace(".zip", ""), self.android_version, 91 | self.host, "system"), os.path.join(self.copy_dir, "vendor"), dirs_exist_ok=True) 92 | self.partition = "vendor" 93 | shutil.copytree(os.path.join(self.extract_to, self.dl_file_name.replace(".zip", ""), self.android_version, 94 | self.host, "vendor"), os.path.join(self.copy_dir, "vendor"), dirs_exist_ok=True) 95 | 96 | def extra1(self): 97 | Logger.info("Setting extra permissions ...") 98 | # set permissions for vendor files 99 | path = os.path.join(self.copy_dir, "vendor", self.files_vendor[0]) 100 | self.set_perm2(path, recursive=True) 101 | 102 | # Copy nessessary files to the overlayfs 103 | container.stop() 104 | copy_dir = "/tmp/waydroid" 105 | if container.use_overlayfs(): 106 | img = os.path.join(images.get_image_dir(), "system.img") 107 | # images.mount(img, copy_dir) 108 | if not os.path.exists(copy_dir): 109 | os.makedirs(copy_dir) 110 | run(["sudo", "mount", img, copy_dir]) 111 | 112 | for file in self.config_files[self.android_version]: 113 | file_dir = os.path.join(self.copy_dir, "system", file) 114 | if not os.path.exists(os.path.dirname(file_dir)): 115 | os.makedirs(os.path.dirname(file_dir)) 116 | shutil.copyfile(os.path.join(copy_dir, "system", file), file_dir) 117 | self.set_perm2(file_dir, recursive=True) 118 | 119 | if self.android_version == "13": 120 | # Copy missing libraries file for android 13 vendor partition from system partition 121 | if not os.path.exists(os.path.join(self.copy_dir, "vendor", "lib64", "hw")): 122 | os.makedirs(os.path.join(self.copy_dir, "vendor", "lib64", "hw")) 123 | 124 | copy_ = True 125 | if "arm" in self.host and self.host_arch[1] == 32: 126 | copy_ = False 127 | if copy_: 128 | shutil.copyfile(os.path.join(copy_dir, "system", "lib64/android.hardware.gnss@1.0.so"), 129 | os.path.join(self.copy_dir, "vendor", "lib64/hw/android.hardware.gnss@1.0.so")) 130 | 131 | if not os.path.exists(os.path.join(self.copy_dir, "vendor", "lib", "hw")): 132 | os.makedirs(os.path.join(self.copy_dir, "vendor", "lib", "hw")) 133 | 134 | shutil.copyfile(os.path.join(copy_dir, "system", "lib/android.hardware.gnss@1.0.so"), 135 | os.path.join(self.copy_dir, "vendor", "lib/hw/android.hardware.gnss@1.0.so")) 136 | 137 | images.umount(copy_dir) 138 | 139 | # Update manifest files 140 | container.upgrade() 141 | 142 | manifest_entry_1 = """ 143 | 144 | android.hardware.gnss 145 | 1.0 146 | 147 | IGnss 148 | default 149 | 150 | 151 | """ 152 | self.update_manifest( 153 | os.path.join(self.copy_dir, "system", self.compatibility_files[self.android_version]), 154 | data=manifest_entry_1, 155 | ) 156 | 157 | manifest_entry_2 = """ 158 | 159 | android.hardware.gnss 160 | hwbinder 161 | 1.0 162 | 163 | IGnss 164 | default 165 | 166 | @1.0::IGnss/default 167 | 168 | """ 169 | self.update_manifest(os.path.join(self.copy_dir, "system", "etc", "vintf", "manifest.xml"), data=manifest_entry_2) 170 | config_nodes = "/var/lib/waydroid/lxc/waydroid/config_nodes" 171 | # lxc.mount.entry = /dev/ttyGPSD dev/ttyGPSD none bind,create=file,optional 0 0 172 | 173 | with open(config_nodes, "a") as f: 174 | f.write(f"lxc.mount.entry = {self.gps_host} dev/{self.usb_name} none bind,create=file,optional 0 0\n") 175 | 176 | with open(os.path.join(self.copy_dir, "system", "build.prop"), "a") as f: 177 | f.write("ro.factory.hasGPS=true\n") 178 | f.write(f"ro.kernel.android.gps={self.usb_name}\n") 179 | f.write(f"ro.kernel.android.gps.speed={self.baud_rate}\n") 180 | Logger.warning( 181 | "You need to add user to the 'dialout' group to access the GPS device." 182 | "\nYou can do this by running: sudo usermod -aG dialout " 183 | "\nand then reboot your system." 184 | ) 185 | def extra2(self): 186 | # Remove vendor files from system partition 187 | self.files = self.files_vendor 188 | self.partition = "vendor" 189 | self.remove() 190 | 191 | # Remove config files from system partition 192 | self.files = self.config_files[self.android_version] 193 | self.partition = "system" 194 | self.remove() 195 | 196 | container.upgrade() 197 | 198 | -------------------------------------------------------------------------------- /stuff/gapps.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | from stuff.general import General 4 | from tools.helper import run 5 | 6 | 7 | class Gapps(General): 8 | id = ... 9 | partition = "system" 10 | dl_links = { 11 | "11": { 12 | "x86_64": ["https://sourceforge.net/projects/opengapps/files/x86_64/20220503/open_gapps-x86_64-11.0-pico-20220503.zip", "5a6d242be34ad1acf92899c7732afa1b"], 13 | "x86": ["https://sourceforge.net/projects/opengapps/files/x86/20220503/open_gapps-x86-11.0-pico-20220503.zip", "efda4943076016d00b40e0874b12ddd3"], 14 | "arm64-v8a": ["https://sourceforge.net/projects/opengapps/files/arm64/20220503/open_gapps-arm64-11.0-pico-20220503.zip", "7790055d34bbfc6fe610b0cd263a7add"], 15 | "armeabi-v7a": ["https://sourceforge.net/projects/opengapps/files/arm/20220215/open_gapps-arm-11.0-pico-20220215.zip", "8719519fa32ae83a62621c6056d32814"] 16 | }, 17 | "13": { 18 | "x86_64": ["https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20231028/MindTheGapps-13.0.0-x86_64-20231028.zip", "63ccebbf93d45c384f58d7c40049d398"], 19 | "x86": ["https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20231028/MindTheGapps-13.0.0-x86-20231028.zip", "f12b6a8ed14eedbb4b5b3c932a865956"], 20 | "arm64-v8a": ["https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20231028/MindTheGapps-13.0.0-arm64-20231028.zip", "11180da0a5d9f2ed2863882c30a8d556"], 21 | "armeabi-v7a": ["https://github.com/s1204IT/MindTheGappsBuilder/releases/download/20231028/MindTheGapps-13.0.0-arm-20231028.zip", "d525c980bac427844aa4cb01628f8a8f"] 22 | } 23 | } 24 | android_version = ... 25 | dl_link = ... 26 | act_md5 = ... 27 | dl_file_name = "gapps.zip" 28 | extract_to = "/tmp/gapps/extract" 29 | non_apks = [ 30 | "defaultetc-common.tar.lz", 31 | "defaultframework-common.tar.lz", 32 | "googlepixelconfig-common.tar.lz", 33 | "vending-common.tar.lz" 34 | ] 35 | skip = [ 36 | "setupwizarddefault-x86_64.tar.lz", 37 | "setupwizardtablet-x86_64.tar.lz" 38 | ] 39 | files = [ 40 | "etc/default-permissions/default-permissions.xml", 41 | "etc/default-permissions/opengapps-permissions-q.xml", 42 | "etc/permissions/com.google.android.maps.xml", 43 | "etc/permissions/com.google.android.media.effects.xml", 44 | "etc/permissions/privapp-permissions-google.xml", 45 | "etc/permissions/split-permissions-google.xml", 46 | "etc/preferred-apps/google.xml", 47 | "etc/sysconfig/google.xml", 48 | "etc/sysconfig/google_build.xml", 49 | "etc/sysconfig/google_exclusives_enable.xml", 50 | "etc/sysconfig/google-hiddenapi-package-whitelist.xml", 51 | "framework/com.google.android.maps.jar", 52 | "framework/com.google.android.media.effects.jar", 53 | "priv-app/AndroidMigratePrebuilt", 54 | "priv-app/GoogleExtServices", 55 | "priv-app/GoogleRestore", 56 | "priv-app/CarrierSetup", 57 | "priv-app/GoogleExtShared", 58 | "priv-app/GoogleServicesFramework", 59 | "priv-app/ConfigUpdater", 60 | "priv-app/GoogleFeedback", 61 | "priv-app/Phonesky", 62 | "priv-app/GoogleBackupTransport", 63 | "priv-app/GoogleOneTimeInitializer", 64 | "priv-app/PrebuiltGmsCore", 65 | "priv-app/GoogleContactsSyncAdapter", 66 | "priv-app/GooglePartnerSetup", 67 | "product/overlay/PlayStoreOverlay.apk", 68 | "product/overlay/GmsOverlay.apk.apk", 69 | "product/overlay/GmsSettingsProviderOverlay.apk", 70 | "system_ext/etc/permissions/privapp-permissions-google-system-ext.xml", 71 | "system_ext/priv-app/GoogleFeedback", 72 | "system_ext/priv-app/GoogleServicesFramework", 73 | "system_ext/priv-app/SetupWizard", 74 | "product/priv-app/GmsCore", 75 | "product/priv-app/AndroidAutoStub", 76 | "product/priv-app/GoogleRestore", 77 | "product/priv-app/Phonesky", 78 | "product/priv-app/Velvet", 79 | "product/priv-app/GooglePartnerSetup", 80 | "product/app/GoogleCalendarSyncAdapter", 81 | "product/app/PrebuiltExchange3Google", 82 | "product/app/GoogleContactsSyncAdapter", 83 | "product/framework/com.google.android.dialer.support.jar", 84 | "product/lib64/libjni_latinimegoogle.so", 85 | "product/etc/default-permissions/default-permissions-google.xml", 86 | "product/etc/default-permissions/default-permissions-mtg.xml", 87 | "product/etc/sysconfig/google.xml", 88 | "product/etc/sysconfig/d2d_cable_migration_feature.xml", 89 | "product/etc/sysconfig/google-hiddenapi-package-allowlist.xml", 90 | "product/etc/sysconfig/google_build.xml", 91 | "product/etc/permissions/privapp-permissions-google-product.xml", 92 | "product/etc/permissions/com.google.android.dialer.support.xml", 93 | "product/etc/security/fsverity/gms_fsverity_cert.der", 94 | "product/lib/libjni_latinimegoogle.so", 95 | ] 96 | 97 | def __init__(self, android_version="11") -> None: 98 | super().__init__() 99 | self.android_version = android_version 100 | self.dl_link = self.dl_links[android_version][self.arch[0]][0] 101 | self.act_md5 = self.dl_links[android_version][self.arch[0]][1] 102 | if android_version == "11": 103 | self.id = "OpenGapps" 104 | else: 105 | self.id = "MindTheGapps" 106 | 107 | def copy(self): 108 | if self.android_version == "11": 109 | return self.copy_11() 110 | elif self.android_version == "13": 111 | return self.copy_13() 112 | 113 | def copy_11(self): 114 | if not os.path.exists(self.extract_to): 115 | os.makedirs(self.extract_to) 116 | if not os.path.exists(os.path.join(self.extract_to, "appunpack")): 117 | os.makedirs(os.path.join(self.extract_to, "appunpack")) 118 | 119 | for lz_file in os.listdir(os.path.join(self.extract_to, "Core")): 120 | for d in os.listdir(os.path.join(self.extract_to, "appunpack")): 121 | shutil.rmtree(os.path.join(self.extract_to, "appunpack", d)) 122 | if lz_file not in self.skip: 123 | if lz_file not in self.non_apks: 124 | print(" Processing app package : " + 125 | os.path.join(self.extract_to, "Core", lz_file)) 126 | run(["tar", "--lzip", "-xvf", os.path.join(self.extract_to, "Core", 127 | lz_file), "-C", os.path.join(self.extract_to, "appunpack")]) 128 | app_name = os.listdir(os.path.join( 129 | self.extract_to, "appunpack"))[0] 130 | xx_dpi = os.listdir(os.path.join( 131 | self.extract_to, "appunpack", app_name))[0] 132 | app_priv = os.listdir(os.path.join( 133 | self.extract_to, "appunpack", app_name, "nodpi"))[0] 134 | app_src_dir = os.path.join( 135 | self.extract_to, "appunpack", app_name, xx_dpi, app_priv) 136 | for app in os.listdir(app_src_dir): 137 | shutil.copytree(os.path.join(app_src_dir, app), os.path.join( 138 | self.copy_dir, self.partition, "priv-app", app), dirs_exist_ok=True) 139 | for f in os.listdir(os.path.join(self.copy_dir, self.partition, "priv-app", app)): 140 | dst_file_path = os.path.join(os.path.join( 141 | self.copy_dir, self.partition, "priv-app", app), f) 142 | if os.path.splitext(dst_file_path)[1].lower() == ".apk": 143 | self.extract_app_lib(dst_file_path) 144 | else: 145 | print(" Processing extra package : " + 146 | os.path.join(self.extract_to, "Core", lz_file)) 147 | run(["tar", "--lzip", "-xvf", os.path.join(self.extract_to, "Core", 148 | lz_file), "-C", os.path.join(self.extract_to, "appunpack")]) 149 | app_name = os.listdir(os.path.join( 150 | self.extract_to, "appunpack"))[0] 151 | common_content_dirs = os.listdir(os.path.join( 152 | self.extract_to, "appunpack", app_name, "common")) 153 | for ccdir in common_content_dirs: 154 | shutil.copytree(os.path.join(self.extract_to, "appunpack", app_name, "common", ccdir), os.path.join( 155 | self.copy_dir, self.partition, ccdir), dirs_exist_ok=True) 156 | 157 | def copy_13(self): 158 | src_dir = os.path.join(self.extract_to, "system") 159 | dst_dir = os.path.join(self.copy_dir, self.partition) 160 | for root, dirs, files in os.walk(src_dir): 161 | dir_name = os.path.basename(root) 162 | # 遍历文件 163 | for file in files: 164 | src_file_path = os.path.join(root, file) 165 | dst_file_path = os.path.join(dst_dir, os.path.relpath( 166 | src_file_path, src_dir)) 167 | if not os.path.exists(os.path.dirname(dst_file_path)): 168 | os.makedirs(os.path.dirname(dst_file_path)) 169 | # Logger.info(f"{src_file_path} -> {dst_file_path}") 170 | shutil.copy2(src_file_path, dst_file_path) 171 | if os.path.splitext(dst_file_path)[1].lower() == ".apk": 172 | self.extract_app_lib(dst_file_path) 173 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | try: 3 | from InquirerLib.InquirerPy import inquirer 4 | from InquirerLib.InquirerPy.base.control import Choice 5 | from InquirerLib.InquirerPy.separator import Separator 6 | except ModuleNotFoundError: 7 | inquirer = None 8 | import argparse 9 | import os 10 | from typing import List 11 | from stuff.android_id import AndroidId 12 | from stuff.gapps import Gapps 13 | from stuff.general import General 14 | from stuff.hidestatusbar import HideStatusBar 15 | from stuff.houdini import Houdini 16 | from stuff.magisk import Magisk 17 | from stuff.microg import MicroG 18 | from stuff.mitm import Mitm 19 | from stuff.ndk import Ndk 20 | from stuff.nodataperm import Nodataperm 21 | from stuff.smartdock import Smartdock 22 | from stuff.widevine import Widevine 23 | from stuff.fdroidpriv import FDroidPriv 24 | from stuff.gps import GPS 25 | import tools.helper as helper 26 | from tools import container 27 | from tools import images 28 | from tools.logger import Logger 29 | 30 | def get_certified(): 31 | AndroidId().get_id() 32 | 33 | def mount(partition, copy_dir): 34 | img = os.path.join(images.get_image_dir(), f"{partition}.img") 35 | mount_point = os.path.join(copy_dir) if partition == "system" else os.path.join(copy_dir, partition) 36 | Logger.info(f"Mounting {img} to {mount_point}") 37 | images.mount(img, mount_point) 38 | 39 | def resize(partition): 40 | img = os.path.join(images.get_image_dir(), f"{partition}.img") 41 | img_size = int(os.path.getsize(img) / (1024 * 1024)) 42 | new_size = f"{img_size + 500}M" 43 | Logger.info(f"Resizing {img} to {new_size}") 44 | images.resize(img, new_size) 45 | 46 | def umount(partition, copy_dir): 47 | mount_point = os.path.join(copy_dir) if partition == "system" else os.path.join(copy_dir, partition) 48 | Logger.info(f"Unmounting {mount_point}") 49 | images.umount(mount_point) 50 | 51 | def install_app(args): 52 | install_list: List[General] = [] 53 | app = args.app 54 | if "gapps" in app: 55 | install_list.append(Gapps(args.android_version)) 56 | if "libndk" in app and "houdini" not in app: 57 | arch = helper.host()[0] 58 | if arch == "x86_64": 59 | install_list.append(Ndk(args.android_version)) 60 | else: 61 | Logger.warn("libndk is not supported on your CPU") 62 | if "libhoudini" in app and "ndk" not in app: 63 | arch = helper.host()[0] 64 | if arch == "x86_64": 65 | install_list.append(Houdini(args.android_version)) 66 | else: 67 | Logger.warn("libhoudini is not supported on your CPU") 68 | if "magisk" in app: 69 | install_list.append(Magisk()) 70 | if "widevine" in app: 71 | install_list.append(Widevine(args.android_version)) 72 | if "smartdock" in app: 73 | install_list.append(Smartdock()) 74 | if "microg" in app: 75 | install_list.append(MicroG(args.android_version, args.microg_variant)) 76 | if "mitm" in app: 77 | install_list.append(Mitm(args.ca_cert_file)) 78 | if "fdroidpriv" in app: 79 | install_list.append(FDroidPriv(args.android_version)) 80 | if "gps" in app: 81 | install_list.append(GPS(args.android_version, args.gps_host, args.baud_rate)) 82 | if not container.use_overlayfs(): 83 | copy_dir = "/tmp/waydroid" 84 | container.stop() 85 | 86 | resize_system, resize_vendor = False, False 87 | for item in install_list: 88 | if item.partition == "system": 89 | resize_system = True 90 | elif item.partition == "vendor": 91 | resize_vendor = True 92 | 93 | if resize_system: 94 | resize("system") 95 | if resize_vendor: 96 | resize("vendor") 97 | 98 | mount("system", copy_dir) 99 | mount("vendor", copy_dir) 100 | 101 | for item in install_list: 102 | item.install() 103 | 104 | if not container.use_overlayfs(): 105 | umount("vendor", copy_dir) 106 | umount("system", copy_dir) 107 | container.upgrade() 108 | 109 | def remove_app(args): 110 | remove_list: List[General] = [] 111 | app = args.app 112 | if "gapps" in app: 113 | remove_list.append(Gapps(args.android_version)) 114 | if "libndk" in app and "houdini" not in app: 115 | remove_list.append(Ndk(args.android_version)) 116 | if "libhoudini" in app and "ndk" not in app: 117 | remove_list.append(Houdini(args.android_version)) 118 | if "magisk" in app: 119 | remove_list.append(Magisk()) 120 | if "widevine" in app: 121 | remove_list.append(Widevine(args.android_version)) 122 | if "smartdock" in app: 123 | remove_list.append(Smartdock()) 124 | if "microg" in app: 125 | remove_list.append(MicroG(args.android_version, args.microg_variant)) 126 | if "mitm" in app: 127 | remove_list.append(Mitm()) 128 | if "fdroidpriv" in app: 129 | remove_list.append(FDroidPriv(args.android_version)) 130 | if "nodataperm" in app: 131 | remove_list.append(Nodataperm(args.android_version)) 132 | if "hidestatusbar" in app: 133 | remove_list.append(HideStatusBar()) 134 | if "gps" in app: 135 | remove_list.append(GPS()) 136 | if not container.use_overlayfs(): 137 | copy_dir = "/tmp/waydroid" 138 | container.stop() 139 | 140 | for item in remove_list: 141 | item.uninstall() 142 | 143 | if not container.use_overlayfs(): 144 | umount("vendor", copy_dir) 145 | umount("system", copy_dir) 146 | 147 | container.upgrade() 148 | 149 | def hack_option(args): 150 | Logger.warning("If these hacks cause any problems, run `sudo python main.py remove ` to remove") 151 | 152 | hack_list: List[General] = [] 153 | options = args.option_name 154 | if "nodataperm" in options: 155 | hack_list.append(Nodataperm()) 156 | if "hidestatusbar" in options: 157 | hack_list.append(HideStatusBar()) 158 | if not container.use_overlayfs(): 159 | copy_dir = "/tmp/waydroid" 160 | container.stop() 161 | 162 | resize_system, resize_vendor = False, False 163 | for item in hack_list: 164 | if item.partition == "system": 165 | resize_system = True 166 | elif item.partition == "vendor": 167 | resize_vendor = True 168 | 169 | if resize_system: 170 | resize("system") 171 | if resize_vendor: 172 | resize("vendor") 173 | 174 | mount("system", copy_dir) 175 | mount("vendor", copy_dir) 176 | 177 | for item in hack_list: 178 | item.install() 179 | 180 | if not container.use_overlayfs(): 181 | umount("vendor", copy_dir) 182 | umount("system", copy_dir) 183 | 184 | container.upgrade() 185 | 186 | def interact(): 187 | if inquirer is None: 188 | print('Please, install InquirerLib module first') 189 | return 190 | os.system("clear") 191 | android_version = inquirer.select( 192 | message="Select Android version", 193 | instruction="(\u2191\u2193 Select Item)", 194 | choices=[ 195 | Choice(name="Android 11", value="11"), 196 | Choice(name="Android 13", value="13"), 197 | Choice(name="Exit", value=None) 198 | ], 199 | default="13", 200 | ).execute() 201 | if not android_version: 202 | exit() 203 | 204 | args = argparse.Namespace(android_version=android_version, microg_variant="Standard") 205 | 206 | action = inquirer.select( 207 | message="Please select an action", 208 | choices=["Install", "Remove", "Hack", "Get Google Device ID to Get Certified"], 209 | instruction="([↑↓]: Select Item)", 210 | default=None, 211 | ).execute() 212 | if not action: 213 | exit() 214 | 215 | install_choices = ["gapps", "microg", "libndk", "libhoudini", "magisk", "smartdock", "fdroidpriv", "gps", "widevine"] 216 | baud_rate_choices = ["9600", "19200", "38400", "57600", "115200"] 217 | hack_choices = [] 218 | hack_choices.extend(["nodataperm", "hidestatusbar"]) 219 | 220 | if action == "Install": 221 | apps = inquirer.checkbox( 222 | message="Select apps", 223 | instruction="([\u2191\u2193]: Select Item. [Space]: Toggle Choice), [Enter]: Confirm", 224 | validate=lambda result: len(result) >= 1, 225 | invalid_message="should be at least 1 selection", 226 | choices=install_choices 227 | ).execute() 228 | microg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"] 229 | if "microg" in apps: 230 | microg_variant = inquirer.select( 231 | message="Select MicroG variant", 232 | choices=microg_variants, 233 | default="Standard", 234 | ).execute() 235 | args.microg_variant = microg_variant 236 | if "gps" in apps: 237 | gps_host = inquirer.text( 238 | message="Enter GPS host (default: /dev/ttyGPSD)", 239 | default="/dev/ttyGPSD", 240 | ).execute() 241 | args.gps_host = gps_host 242 | baud_rate = inquirer.select( 243 | message="Enter baud rate (default: 9600)", 244 | instruction="([\u2191\u2193]: [Enter]: Confirm", 245 | default="9600", 246 | choices=baud_rate_choices 247 | ).execute() 248 | args.baud_rate = baud_rate 249 | args.app = apps 250 | install_app(args) 251 | elif action == "Remove": 252 | apps = inquirer.checkbox( 253 | message="Select apps", 254 | instruction="([\u2191\u2193]: Select Item. [Space]: Toggle Choice), [Enter]: Confirm", 255 | validate=lambda result: len(result) >= 1, 256 | invalid_message="should be at least 1 selection", 257 | choices=[*install_choices, *hack_choices] 258 | ).execute() 259 | args.app = apps 260 | args.microg_variant = "Standard" 261 | remove_app(args) 262 | elif action == "Hack": 263 | apps = inquirer.checkbox( 264 | message="Select hack options", 265 | instruction="([\u2191\u2193]: Select Item. [Space]: Toggle Choice), [Enter]: Confirm", 266 | validate=lambda result: len(result) >= 1, 267 | invalid_message="should be at least 1 selection", 268 | choices=hack_choices 269 | ).execute() 270 | args.option_name = apps 271 | hack_option(args) 272 | elif action == "Get Google Device ID to Get Certified": 273 | get_certified() 274 | 275 | def main(): 276 | parser = argparse.ArgumentParser(description=''' 277 | Does stuff like installing Gapps, installing Magisk, installing NDK Translation and getting Android ID for device registration. 278 | Use -h flag for help!''') 279 | 280 | subparsers = parser.add_subparsers(title="command", dest='command') 281 | parser.add_argument('-a', '--android-version', 282 | dest='android_version', 283 | help='Specify the Android version', 284 | default="13", 285 | choices=["11", "13"]) 286 | 287 | # android command 288 | certified = subparsers.add_parser( 289 | 'certified', help='Get device ID to obtain Play Store certification') 290 | certified.set_defaults(func=get_certified) 291 | 292 | install_choices = ["gapps", "microg", "libndk", "libhoudini", "magisk", "mitm", "smartdock", "widevine", "gps"] 293 | hack_choices = ["nodataperm", "hidestatusbar"] 294 | micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"] 295 | remove_choices = install_choices 296 | 297 | arg_template = { 298 | "dest": "app", 299 | "type": str, 300 | "nargs": '+' 301 | } 302 | 303 | install_help = """ 304 | gapps: Install Open GApps (Android 11) or MindTheGapps (Android 13) 305 | microg: Add microG, Aurora Store and Aurora Droid to WayDriod 306 | libndk: Add libndk arm translation, better for AMD CPUs 307 | libhoudini: Add libhoudini arm translation, better for Intel CPUs 308 | magisk: Install Magisk Delta to WayDroid 309 | mitm -c CA_CERT_FILE: Install root CA cert into system trust store 310 | smartdock: A desktop mode launcher for Android 311 | widevine: Add support for widevine DRM L3 312 | """ 313 | # install and its aliases 314 | install_parser = subparsers.add_parser( 315 | 'install', formatter_class=argparse.RawTextHelpFormatter, help='Install an app') 316 | install_parser.add_argument( 317 | **arg_template, choices=install_choices, help=install_help) 318 | install_parser.add_argument('-c', '--ca-cert', 319 | dest='ca_cert_file', 320 | help='[for mitm only] The CA certificate file (*.pem) to install', 321 | default=None) 322 | install_parser.set_defaults(func=install_app) 323 | 324 | # remove and its aliases 325 | remove_parser = subparsers.add_parser( 326 | 'remove', aliases=["uninstall"], help='Remove an app') 327 | remove_parser.add_argument( 328 | **arg_template, choices=[*remove_choices, * hack_choices], help='Name of app to remove') 329 | remove_parser.set_defaults(func=remove_app) 330 | 331 | # hack and its aliases 332 | hack_parser = subparsers.add_parser('hack', help='Hack the system') 333 | hack_parser.add_argument( 334 | 'option_name', nargs="+", choices=hack_choices, help='Name of hack option') 335 | hack_parser.set_defaults(func=hack_option) 336 | 337 | args = parser.parse_args() 338 | args.microg_variant = os.environ.get("MICROG_VARIANT", "Standard") 339 | args.gps_host = os.environ.get("GPS_HOST", "/dev/ttyGPSD") 340 | args.baud_rate = os.environ.get("BAUD_RATE", "9600") 341 | if hasattr(args, 'func'): 342 | helper.check_root() 343 | args.func(args) 344 | else: 345 | helper.check_root() 346 | interact() 347 | 348 | if __name__ == "__main__": 349 | main() 350 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------