diff --git a/README.md b/README.md index c20553a..9d80e2f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Waydroid Extras Script + Script to add GApps and other stuff to Waydroid! # Installation/Usage @@ -8,8 +9,9 @@ Script to add GApps and other stuff to Waydroid! ``` git clone https://github.com/casualsnek/waydroid_script cd waydroid_script -sudo python3 -m pip install -r -sudo python main.py +python3 -m venv venv +venv/bin/pip install -r requirements.txt +sudo venv/bin/python3 main.py ``` ![image-20230430013103883](assets/img/README/image-20230430013103883.png) @@ -22,17 +24,20 @@ sudo python main.py ## Command Line - git clone https://github.com/casualsnek/waydroid_script - cd waydroid_script - sudo python3 -m pip install -r requirements.txt - # install something - sudo python3 main.py install {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg} - # uninstall something - sudo python3 main.py uninstall {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg} - # get Android device ID - sudo python main.py certified - # some hacks - sudo python3 hack {nodataperm, hidestatusbar} +```bash +git clone https://github.com/casualsnek/waydroid_script +cd waydroid_script +python3 -m venv venv +venv/bin/pip install -r requirements.txt +# install something +sudo venv/bin/python3 main.py install {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg} +# uninstall something +sudo venv/bin/python3 main.py uninstall {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg} +# get Android device ID +sudo venv/bin/python3 main.py certified +# some hacks +sudo venv/bin/python3 main.py hack {nodataperm, hidestatusbar} +``` ## Dependencies @@ -52,7 +57,7 @@ sudo python main.py Open terminal and switch to the directory where "main.py" is located then run: - sudo python3 main.py install gapps + sudo venv/bin/python3 main.py install gapps Then launch waydroid with: @@ -63,13 +68,14 @@ After waydroid has finished booting, open terminal and switch to directory where sudo python3 main.py google 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! + ## Install Magisk ![](assets/2.png) Open terminal and switch to directory where "main.py" is located then run: - sudo python3 main.py install magisk + sudo venv/bin/python3 main.py install magisk Magisk will be installed on next boot! @@ -87,7 +93,7 @@ libndk seems to have better performance than libhoudini on AMD. Open terminal and switch to directory where "main.py" is located then run: - sudo python3 main.py install libndk + sudo venv/bin/python3 main.py install libndk ## Install libhoudini arm translation @@ -99,7 +105,7 @@ houdini64 version: 11.0.1b_z.38765.m Open terminal and switch to directory where "main.py" is located then run: - sudo python3 main.py install libhoudini + sudo venv/bin/python3 main.py install libhoudini ## Integrate Widevine DRM (L3) @@ -107,7 +113,7 @@ Open terminal and switch to directory where "main.py" is located then run: Open terminal and switch to directory where "main.py" is located then run: - sudo python3 main.py install widevine + sudo venv/bin/python3 main.py install widevine ## Install Smart Dock @@ -116,7 +122,7 @@ Open terminal and switch to directory where "main.py" is located then run: Open terminal and switch to directory where "main.py" is located then run: - sudo python3 main.py install smartdock + sudo venv/bin/python3 main.py install smartdock ## Granting full permission for apps data (HACK) @@ -130,9 +136,9 @@ Arknights, PUNISHING: GRAY RAVEN and other games won't freeze on the black scree Open terminal and switch to directory where "main.py" is located then run: ``` -sudo python3 main.py hack nodataperm +sudo venv/bin/python3 main.py hack nodataperm ``` -**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 python3 main.py uninstall nodataperm` to remove it. +**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. 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. @@ -165,7 +171,7 @@ After ![After](assets/9.png) ``` -sudo python3 main.py hack hidestatusbar +sudo venv/bin/python3 main.py hack hidestatusbar ``` @@ -174,7 +180,7 @@ sudo python3 main.py hack hidestatusbar 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: Open terminal and switch to directory where "main.py" is located then run: - sudo python3 main.py google + sudo venv/bin/python3 main.py certified Star this repository if you find this useful, if you encounter problem create an issue on GitHub! diff --git a/main.py b/main.py index 67c26ae..79889fe 100755 --- a/main.py +++ b/main.py @@ -82,7 +82,7 @@ def install_app(args): if "smartdock" in app: install_list.append(Smartdock()) if "microg" in app: - install_list.append(MicroG(args.android_version)) + install_list.append(MicroG(args.android_version, args.microg_variant)) if not container.use_overlayfs(): copy_dir = "/tmp/waydroid" @@ -235,7 +235,7 @@ def interact(): ).execute() microg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"] - if "MicroG" in apps: + if "microg" in apps: microg_variant = inquirer.select( message="Select MicroG variant", choices=microg_variants, diff --git a/stuff/android_id.py b/stuff/android_id.py index 75acbb1..db3c1d8 100644 --- a/stuff/android_id.py +++ b/stuff/android_id.py @@ -14,7 +14,7 @@ class AndroidId: except: return else: - Logger.error("WayDroid isn't running !") + Logger.error("Please make sure Waydroid is running and Gapps has been installed!") return print(queryout.replace("android_id|", "").strip()) print(" ^----- Open https://google.com/android/uncertified/?pli=1") diff --git a/stuff/general.py b/stuff/general.py index f377e0b..3dc0962 100644 --- a/stuff/general.py +++ b/stuff/general.py @@ -73,8 +73,8 @@ class General: if not os.path.isfile(os.path.join(bin_dir, "resetprop")): if not os.path.exists(bin_dir): os.makedirs(bin_dir) - shutil.copy(os.path.join( - "./bin", self.arch[0], "resetprop"), bin_dir) + shutil.copy(os.path.join(os.path.join(os.path.dirname(__file__), "..", "bin", + self.arch[0], "resetprop")), bin_dir) os.chmod(os.path.join(bin_dir, "resetprop"), 0o755) if not os.path.isfile(os.path.join(bin_dir, "resetprop.sh")): with open(os.path.join(bin_dir, "resetprop.sh"), "w") as f: diff --git a/stuff/hidestatusbar.py b/stuff/hidestatusbar.py index 41a4483..1953cd3 100644 --- a/stuff/hidestatusbar.py +++ b/stuff/hidestatusbar.py @@ -5,8 +5,8 @@ from stuff.general import General class HideStatusBar(General): id = "hide status bar" - dl_links = {"11": ["https://github.com/ayasa520/hide-status-bar/releases/download/v0.0.1/app-release.apk", - "ae6c4cc567d6f3de77068e54e43818e2"]} + dl_links = {"11": ["https://github.com/ayasa520/hide-status-bar/releases/download/v0.0.2/app-release.apk", + "ff2fe63ddfb4b035e6720a1b195b2355"]} partition = "system" dl_file_name = "hidestatusbar.apk" dl_link = ... diff --git a/stuff/nodataperm.py b/stuff/nodataperm.py index f0e4e99..4f140db 100644 --- a/stuff/nodataperm.py +++ b/stuff/nodataperm.py @@ -1,7 +1,8 @@ -import gzip import os +import re import shutil from stuff.general import General +from tools.helper import backup, restore from tools.logger import Logger from tools import container @@ -9,9 +10,14 @@ from tools import container class Nodataperm(General): id = "nodataperm" dl_links = { - "11": ["https://github.com/ayasa520/hack_full_data_permission/archive/refs/heads/main.zip", - "eafd7b0986f3edaebaf1dd89f19d49bf"], - "13": ["", ""] + "11": + { + "x86_64": [ + "https://github.com/ayasa520/hack_full_data_permission/archive/d4beab7780eb792059d33e77d865579c9ee41546.zip", + "b0e3908ffcf5df8ea62f4929aa680f1a" + ], + }, + "13": {} } dl_file_name = "nodataperm.zip" extract_to = "/tmp/nodataperm" @@ -21,25 +27,34 @@ class Nodataperm(General): files = [ "etc/nodataperm.sh", "etc/init/nodataperm.rc", - "framework/services.jar" + "framework/services.jar", + "framework/services.jar.prof", + "framework/services.jar.bprof", ] def __init__(self, android_version="11") -> None: super().__init__() - self.dl_link = self.dl_links[android_version][0] - self.act_md5 = self.dl_links[android_version][1] + print("ok") + arch = self.arch[0] + self.dl_link = self.dl_links[android_version][arch][0] + self.act_md5 = self.dl_links[android_version][arch][1] def copy(self): + name = re.findall("([a-zA-Z0-9]+)\.zip", self.dl_link)[0] extract_path = os.path.join( - self.extract_to, "hack_full_data_permission-main") + self.extract_to, f"hack_full_data_permission-{name}") if not container.use_overlayfs(): services_jar = os.path.join( self.copy_dir, self.partition, "framework", "services.jar") - gz_filename = services_jar+".gz" - with gzip.open(gz_filename, 'wb') as f_gz: - with open(services_jar, "rb") as f: - f_gz.write(f.read()) - Logger.info("Copying widevine library files ...") + services_jar_prof = os.path.join( + self.copy_dir, self.partition, "framework", "services.jar.prof") + services_jar_bprof = os.path.join( + self.copy_dir, self.partition, "framework", "services.jar.bprof") + backup(services_jar) + backup(services_jar_prof) + backup(services_jar_bprof) + + Logger.info(f"Copying {self.id} library files ...") shutil.copytree(extract_path, os.path.join( self.copy_dir, self.partition), dirs_exist_ok=True) @@ -47,7 +62,10 @@ class Nodataperm(General): if not container.use_overlayfs(): services_jar = os.path.join( self.copy_dir, self.partition, "framework", "services.jar") - gz_filename = services_jar+".gz" - with gzip.GzipFile(gz_filename) as f_gz: - with open(services_jar, "wb") as f: - f.writelines(f_gz) + services_jar_prof = os.path.join( + self.copy_dir, self.partition, "framework", "services.jar.prof") + services_jar_bprof = os.path.join( + self.copy_dir, self.partition, "framework", "services.jar.bprof") + restore(services_jar) + restore(services_jar_prof) + restore(services_jar_bprof) diff --git a/stuff/smartdock.py b/stuff/smartdock.py index 2741e07..5b2e8ae 100644 --- a/stuff/smartdock.py +++ b/stuff/smartdock.py @@ -4,10 +4,10 @@ from stuff.general import General class Smartdock(General): id = "smartdock" - dl_link = "https://f-droid.org/repo/cu.axel.smartdock_198.apk" + dl_link = "https://f-droid.org/repo/cu.axel.smartdock_1100.apk" partition = "system" dl_file_name = "smartdock.apk" - act_md5 = "a8ce0bca5e1772796404602e0fa250a4" + act_md5 = "f4087d34218eac902a5cca98ee03d215" apply_props = { "qemu.hw.mainkeys" : "1" } skip_extract = True permissions = """ diff --git a/tools/helper.py b/tools/helper.py index 6ef84cd..a4dd78b 100644 --- a/tools/helper.py +++ b/tools/helper.py @@ -1,3 +1,4 @@ +import gzip import os import re import platform @@ -131,3 +132,15 @@ def check_root(): if os.geteuid() != 0: Logger.error("This script must be run as root. Aborting.") sys.exit(1) + +def backup(path): + gz_filename = path+".gz" + with gzip.open(gz_filename, 'wb') as f_gz: + with open(path, "rb") as f: + f_gz.write(f.read()) + +def restore(path): + gz_filename = path+".gz" + with gzip.GzipFile(gz_filename) as f_gz: + with open(path, "wb") as f: + f.writelines(f_gz)