Add interactive command line interface
This commit is contained in:
parent
48ea54fc3e
commit
3900328b83
7 changed files with 226 additions and 132 deletions
42
README.md
42
README.md
|
|
@ -11,15 +11,35 @@ Script to add gapps and other stuff to waydroid !
|
||||||
sudo dnf install lzip
|
sudo dnf install lzip
|
||||||
## openSUSE based distributions:
|
## openSUSE based distributions:
|
||||||
sudo zypper install lzip
|
sudo zypper install lzip
|
||||||
Then run:
|
|
||||||
|
|
||||||
|
## Interactive terminal interface
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/casualsnek/waydroid_script
|
||||||
|
cd waydroid_script
|
||||||
|
sudo python main.py
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Command Line
|
||||||
|
|
||||||
git clone https://github.com/casualsnek/waydroid_script
|
git clone https://github.com/casualsnek/waydroid_script
|
||||||
cd waydroid_script
|
cd waydroid_script
|
||||||
sudo python3 -m pip install -r requirements.txt
|
sudo python3 -m pip install -r requirements.txt
|
||||||
# install something
|
# install something
|
||||||
sudo python3 main.py install {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg, hidestatus}
|
sudo python3 main.py install {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg}
|
||||||
# uninstall something
|
# uninstall something
|
||||||
sudo python3 main.py uninstall {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg, hidestatus}
|
sudo python3 main.py uninstall {gapps, magisk, libndk, libhoudini, nodataperm, smartdock, microg}
|
||||||
|
# some hacks
|
||||||
|
sudo python3 hack {nodataperm, hidestatusbar}
|
||||||
|
|
||||||
## Install OpenGapps
|
## Install OpenGapps
|
||||||
|
|
||||||
|
|
@ -107,7 +127,7 @@ Open terminal and switch to directory where "main.py" is located then run:
|
||||||
```
|
```
|
||||||
sudo python3 main.py install nodataperm
|
sudo python3 main.py install 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 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.
|
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.
|
||||||
|
|
@ -140,7 +160,7 @@ After
|
||||||

|

|
||||||
|
|
||||||
```
|
```
|
||||||
sudo python3 main.py install hidestatus
|
sudo python3 main.py install hidestatusbar
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -155,16 +175,6 @@ Star this repository if you find this useful, if you encounter problem create a
|
||||||
|
|
||||||
## Error handling
|
## Error handling
|
||||||
|
|
||||||
- WayDroid no longer boots
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo waydroid upgrade -o
|
|
||||||
sudo systemctl restart waydroid-container.service
|
|
||||||
```
|
|
||||||
This will make `/var/lib/waydroid/waydroid_base.prop` return to original state, so libndk/libhoudini will be invalid. You need to modify `waydroid_base.prop` again.
|
|
||||||
|
|
||||||
Or use `sudo python3 main.py uninstall xxxxx` to remove what is causing the issue.
|
|
||||||
|
|
||||||
- Magisk installed: N/A
|
- Magisk installed: N/A
|
||||||
|
|
||||||
Check [waydroid-magisk](https://github.com/nitanmarcel/waydroid-magisk)
|
Check [waydroid-magisk](https://github.com/nitanmarcel/waydroid-magisk)
|
||||||
|
|
|
||||||
BIN
assets/img/README/image-20230430013103883.png
Normal file
BIN
assets/img/README/image-20230430013103883.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
assets/img/README/image-20230430013119763.png
Normal file
BIN
assets/img/README/image-20230430013119763.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
assets/img/README/image-20230430013148814.png
Normal file
BIN
assets/img/README/image-20230430013148814.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
308
main.py
308
main.py
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
from InquirerPy import inquirer
|
||||||
|
from InquirerPy.base.control import Choice
|
||||||
|
from InquirerPy.separator import Separator
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
@ -56,135 +58,210 @@ def umount(partition, copy_dir):
|
||||||
images.umount(mount_point)
|
images.umount(mount_point)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def install_app(args):
|
||||||
|
install_list: List[General] = []
|
||||||
|
app = args.app
|
||||||
|
if "gapps" in app:
|
||||||
|
install_list.append(Gapps(args.android_version))
|
||||||
|
if "libndk" in app and "houdini" not in app:
|
||||||
|
arch = helper.host()[0]
|
||||||
|
if arch == "x86_64":
|
||||||
|
install_list.append(Ndk(args.android_version))
|
||||||
|
else:
|
||||||
|
Logger.warn("libndk is not supported on your CPU")
|
||||||
|
if "libhoudini" in app and "ndk" not in app:
|
||||||
|
arch = helper.host()[0]
|
||||||
|
if arch == "x86_64":
|
||||||
|
install_list.append(Houdini(args.android_version))
|
||||||
|
else:
|
||||||
|
Logger.warn("libhoudini is not supported on your CPU")
|
||||||
|
if "magisk" in app:
|
||||||
|
install_list.append(Magisk())
|
||||||
|
if "widevine" in app:
|
||||||
|
install_list.append(Widevine(args.android_version))
|
||||||
|
if "smartdock" in app:
|
||||||
|
install_list.append(Smartdock())
|
||||||
|
if "microg" in app:
|
||||||
|
install_list.append(MicroG(args.android_version))
|
||||||
|
|
||||||
def install_app(args):
|
if not container.use_overlayfs():
|
||||||
install_list: List[General] = []
|
copy_dir = "/tmp/waydroid"
|
||||||
app = args.app
|
container.stop()
|
||||||
if "gapps" in app:
|
|
||||||
install_list.append(Gapps(args.android_version))
|
|
||||||
if "libndk" in app and "houdini" not in app:
|
|
||||||
arch = helper.host()[0]
|
|
||||||
if arch == "x86_64":
|
|
||||||
install_list.append(Ndk(args.android_version))
|
|
||||||
else:
|
|
||||||
Logger.warn("libndk is not supported on your CPU")
|
|
||||||
if "libhoudini" in app and "ndk" not in app:
|
|
||||||
arch = helper.host()[0]
|
|
||||||
if arch == "x86_64":
|
|
||||||
install_list.append(Houdini(args.android_version))
|
|
||||||
else:
|
|
||||||
Logger.warn("libhoudini is not supported on your CPU")
|
|
||||||
if "magisk" in app:
|
|
||||||
install_list.append(Magisk())
|
|
||||||
if "widevine" in app:
|
|
||||||
install_list.append(Widevine(args.android_version))
|
|
||||||
if "smartdock" in app:
|
|
||||||
install_list.append(Smartdock())
|
|
||||||
if "microg" in app:
|
|
||||||
install_list.append(MicroG(args.android_version))
|
|
||||||
|
|
||||||
if not container.use_overlayfs():
|
resize_system, resize_vendor = False, False
|
||||||
copy_dir = "/tmp/waydroid"
|
|
||||||
container.stop()
|
|
||||||
|
|
||||||
resize_system, resize_vendor = False, False
|
|
||||||
for item in install_list:
|
|
||||||
if item.partition == "system":
|
|
||||||
resize_system = True
|
|
||||||
elif item.partition == "vendor":
|
|
||||||
resize_vendor = True
|
|
||||||
|
|
||||||
if resize_system:
|
|
||||||
resize("system")
|
|
||||||
if resize_vendor:
|
|
||||||
resize("vendor")
|
|
||||||
|
|
||||||
mount("system", copy_dir)
|
|
||||||
mount("vendor", copy_dir)
|
|
||||||
|
|
||||||
for item in install_list:
|
for item in install_list:
|
||||||
item.install()
|
if item.partition == "system":
|
||||||
|
resize_system = True
|
||||||
|
elif item.partition == "vendor":
|
||||||
|
resize_vendor = True
|
||||||
|
|
||||||
if not container.use_overlayfs():
|
if resize_system:
|
||||||
umount("vendor", copy_dir)
|
resize("system")
|
||||||
umount("system", copy_dir)
|
if resize_vendor:
|
||||||
|
resize("vendor")
|
||||||
|
|
||||||
container.upgrade()
|
mount("system", copy_dir)
|
||||||
|
mount("vendor", copy_dir)
|
||||||
|
|
||||||
def remove_app(args):
|
for item in install_list:
|
||||||
remove_list: List[General] = []
|
item.install()
|
||||||
app = args.app
|
|
||||||
if "gapps" in app:
|
|
||||||
remove_list.append(Gapps(args.android_version))
|
|
||||||
if "libndk" in app and "houdini" not in app:
|
|
||||||
remove_list.append(Ndk(args.android_version))
|
|
||||||
if "libhoudini" in app and "ndk" not in app:
|
|
||||||
remove_list.append(Houdini(args.android_version))
|
|
||||||
if "magisk" in app:
|
|
||||||
remove_list.append(Magisk())
|
|
||||||
if "widevine" in app:
|
|
||||||
remove_list.append(Widevine(args.android_version))
|
|
||||||
if "smartdock" in app:
|
|
||||||
remove_list.append(Smartdock())
|
|
||||||
if "microg" in app:
|
|
||||||
remove_list.append(MicroG(args.android_version))
|
|
||||||
if "nodataperm" in app:
|
|
||||||
remove_list.append(Nodataperm(args.android_version))
|
|
||||||
if "hidestatusbar" in app:
|
|
||||||
remove_list.append(HideStatusBar())
|
|
||||||
|
|
||||||
if not container.use_overlayfs():
|
if not container.use_overlayfs():
|
||||||
copy_dir = "/tmp/waydroid"
|
umount("vendor", copy_dir)
|
||||||
container.stop()
|
umount("system", copy_dir)
|
||||||
|
|
||||||
for item in remove_list:
|
container.upgrade()
|
||||||
item.uninstall()
|
|
||||||
|
|
||||||
if not container.use_overlayfs():
|
|
||||||
umount("vendor", copy_dir)
|
|
||||||
umount("system", copy_dir)
|
|
||||||
|
|
||||||
container.upgrade()
|
def remove_app(args):
|
||||||
|
remove_list: List[General] = []
|
||||||
|
app = args.app
|
||||||
|
if "gapps" in app:
|
||||||
|
remove_list.append(Gapps(args.android_version))
|
||||||
|
if "libndk" in app and "houdini" not in app:
|
||||||
|
remove_list.append(Ndk(args.android_version))
|
||||||
|
if "libhoudini" in app and "ndk" not in app:
|
||||||
|
remove_list.append(Houdini(args.android_version))
|
||||||
|
if "magisk" in app:
|
||||||
|
remove_list.append(Magisk())
|
||||||
|
if "widevine" in app:
|
||||||
|
remove_list.append(Widevine(args.android_version))
|
||||||
|
if "smartdock" in app:
|
||||||
|
remove_list.append(Smartdock())
|
||||||
|
if "microg" in app:
|
||||||
|
remove_list.append(MicroG(args.android_version, args.microg_variant))
|
||||||
|
if "nodataperm" in app:
|
||||||
|
remove_list.append(Nodataperm(args.android_version))
|
||||||
|
if "hidestatusbar" in app:
|
||||||
|
remove_list.append(HideStatusBar())
|
||||||
|
|
||||||
def hack_option(args):
|
if not container.use_overlayfs():
|
||||||
Logger.warning("If these hacks cause any problems, run `sudo python main.py remove <hack_option>` to remove")
|
copy_dir = "/tmp/waydroid"
|
||||||
|
container.stop()
|
||||||
|
|
||||||
hack_list: List[General] = []
|
for item in remove_list:
|
||||||
options = args.option_name
|
item.uninstall()
|
||||||
if "nodataperm" in options:
|
|
||||||
hack_list.append(Nodataperm())
|
|
||||||
if "hidestatusbar" in options:
|
|
||||||
hack_list.append(HideStatusBar())
|
|
||||||
|
|
||||||
if not container.use_overlayfs():
|
if not container.use_overlayfs():
|
||||||
copy_dir = "/tmp/waydroid"
|
umount("vendor", copy_dir)
|
||||||
container.stop()
|
umount("system", copy_dir)
|
||||||
|
|
||||||
resize_system, resize_vendor = False, False
|
container.upgrade()
|
||||||
for item in hack_list:
|
|
||||||
if item.partition == "system":
|
|
||||||
resize_system = True
|
|
||||||
elif item.partition == "vendor":
|
|
||||||
resize_vendor = True
|
|
||||||
|
|
||||||
if resize_system:
|
|
||||||
resize("system")
|
|
||||||
if resize_vendor:
|
|
||||||
resize("vendor")
|
|
||||||
|
|
||||||
mount("system", copy_dir)
|
def hack_option(args):
|
||||||
mount("vendor", copy_dir)
|
Logger.warning(
|
||||||
|
"If these hacks cause any problems, run `sudo python main.py remove <hack_option>` to remove")
|
||||||
|
|
||||||
|
hack_list: List[General] = []
|
||||||
|
options = args.option_name
|
||||||
|
if "nodataperm" in options:
|
||||||
|
hack_list.append(Nodataperm())
|
||||||
|
if "hidestatusbar" in options:
|
||||||
|
hack_list.append(HideStatusBar())
|
||||||
|
|
||||||
|
if not container.use_overlayfs():
|
||||||
|
copy_dir = "/tmp/waydroid"
|
||||||
|
container.stop()
|
||||||
|
|
||||||
|
resize_system, resize_vendor = False, False
|
||||||
for item in hack_list:
|
for item in hack_list:
|
||||||
item.install()
|
if item.partition == "system":
|
||||||
|
resize_system = True
|
||||||
|
elif item.partition == "vendor":
|
||||||
|
resize_vendor = True
|
||||||
|
|
||||||
if not container.use_overlayfs():
|
if resize_system:
|
||||||
umount("vendor", copy_dir)
|
resize("system")
|
||||||
umount("system", copy_dir)
|
if resize_vendor:
|
||||||
|
resize("vendor")
|
||||||
|
|
||||||
container.upgrade()
|
mount("system", copy_dir)
|
||||||
|
mount("vendor", copy_dir)
|
||||||
|
|
||||||
|
for item in hack_list:
|
||||||
|
item.install()
|
||||||
|
|
||||||
|
if not container.use_overlayfs():
|
||||||
|
umount("vendor", copy_dir)
|
||||||
|
umount("system", copy_dir)
|
||||||
|
|
||||||
|
container.upgrade()
|
||||||
|
|
||||||
|
|
||||||
|
def interact():
|
||||||
|
os.system("clear")
|
||||||
|
args = argparse.Namespace()
|
||||||
|
android_version = inquirer.select(
|
||||||
|
message="Select Android version",
|
||||||
|
instruction="(\u2191\u2193 Select Item)",
|
||||||
|
choices=[
|
||||||
|
Choice(name="Android 11", value="11"),
|
||||||
|
Choice(name="Android 13", value="13"),
|
||||||
|
Choice(name="Exit", value=None)
|
||||||
|
],
|
||||||
|
default="11",
|
||||||
|
).execute()
|
||||||
|
if not android_version:
|
||||||
|
exit()
|
||||||
|
args.android_version = android_version
|
||||||
|
action = inquirer.select(
|
||||||
|
message="Please select an action",
|
||||||
|
choices=[
|
||||||
|
"Install",
|
||||||
|
"Remove",
|
||||||
|
"Hack",
|
||||||
|
],
|
||||||
|
default=None,
|
||||||
|
).execute()
|
||||||
|
if not action:
|
||||||
|
exit()
|
||||||
|
install_choices = ["gapps", "microg", "libndk",
|
||||||
|
"libhoudini", "magisk", "smartdock", "widevine"]
|
||||||
|
hack_choices = ["nodataperm", "hidestatusbar"]
|
||||||
|
if action == "Install":
|
||||||
|
apps = inquirer.checkbox(
|
||||||
|
message="Select apps",
|
||||||
|
instruction="([\u2191\u2193]: Select Item. [Space]: toggle choice), [Enter]: Confirm",
|
||||||
|
validate=lambda result: len(result) >= 1,
|
||||||
|
invalid_message="should be at least 1 selection",
|
||||||
|
choices=install_choices
|
||||||
|
).execute()
|
||||||
|
microg_variants = ["Standard", "NoGoolag",
|
||||||
|
"UNLP", "Minimal", "MinimalIAP"]
|
||||||
|
if "MicroG" in apps:
|
||||||
|
microg_variant = inquirer.select(
|
||||||
|
message="Select MicroG variant",
|
||||||
|
choices=microg_variants,
|
||||||
|
default="Standard",
|
||||||
|
).execute()
|
||||||
|
args.microg_variant = microg_variant
|
||||||
|
args.app = apps
|
||||||
|
install_app(args)
|
||||||
|
elif action == "Remove":
|
||||||
|
apps = inquirer.checkbox(
|
||||||
|
message="Select apps",
|
||||||
|
instruction="([\u2191\u2193]: Select Item. [Space]: toggle choice), [Enter]: Confirm",
|
||||||
|
validate=lambda result: len(result) >= 1,
|
||||||
|
invalid_message="should be at least 1 selection",
|
||||||
|
choices=[*install_choices, *hack_choices]
|
||||||
|
).execute()
|
||||||
|
args.app = apps
|
||||||
|
args.microg_variant="Standard"
|
||||||
|
remove_app(args)
|
||||||
|
elif action == "Havk":
|
||||||
|
apps = inquirer.checkbox(
|
||||||
|
message="Select hack options",
|
||||||
|
instruction="([\u2191\u2193]: Select Item. [Space]: toggle choice), [Enter]: Confirm",
|
||||||
|
validate=lambda result: len(result) >= 1,
|
||||||
|
invalid_message="should be at least 1 selection",
|
||||||
|
choices=hack_choices
|
||||||
|
).execute()
|
||||||
|
args.option_name = apps
|
||||||
|
remove_app(args)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='''
|
parser = argparse.ArgumentParser(description='''
|
||||||
Does stuff like installing Gapps, installing Magisk, installing NDK Translation and getting Android ID for device registration.
|
Does stuff like installing Gapps, installing Magisk, installing NDK Translation and getting Android ID for device registration.
|
||||||
Use -h flag for help!''')
|
Use -h flag for help!''')
|
||||||
|
|
@ -231,24 +308,27 @@ widevine: Add support for widevine DRM L3
|
||||||
install_parser.set_defaults(func=install_app)
|
install_parser.set_defaults(func=install_app)
|
||||||
|
|
||||||
# remove and its aliases
|
# remove and its aliases
|
||||||
remove_parser = subparsers.add_parser('remove',aliases=["uninstall"], help='Remove an app')
|
remove_parser = subparsers.add_parser(
|
||||||
|
'remove', aliases=["uninstall"], help='Remove an app')
|
||||||
remove_parser.add_argument(
|
remove_parser.add_argument(
|
||||||
**arg_template, choices=[*remove_choices,* hack_choices], help='Name of app to remove')
|
**arg_template, choices=[*remove_choices, * hack_choices], help='Name of app to remove')
|
||||||
remove_parser.set_defaults(func=remove_app)
|
remove_parser.set_defaults(func=remove_app)
|
||||||
|
|
||||||
# hack and its aliases
|
# hack and its aliases
|
||||||
hack_parser = subparsers.add_parser('hack', help='Hack the system')
|
hack_parser = subparsers.add_parser('hack', help='Hack the system')
|
||||||
hack_parser.add_argument(
|
hack_parser.add_argument(
|
||||||
'option_name',nargs="+" , choices=hack_choices, help='Name of hack option')
|
'option_name', nargs="+", choices=hack_choices, help='Name of hack option')
|
||||||
hack_parser.set_defaults(func=hack_option)
|
hack_parser.set_defaults(func=hack_option)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
args.microg_variant = "Standard"
|
||||||
if hasattr(args, 'func'):
|
if hasattr(args, 'func'):
|
||||||
args_dict = vars(args)
|
args_dict = vars(args)
|
||||||
helper.check_root()
|
helper.check_root()
|
||||||
args.func(args)
|
args.func(args)
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
helper.check_root()
|
||||||
|
interact()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ service microg_service /system/bin/sh /system/bin/npem
|
||||||
"etc/init/microg.rc",
|
"etc/init/microg.rc",
|
||||||
"etc/permissions/com.google.android.backuptransport.xml",
|
"etc/permissions/com.google.android.backuptransport.xml",
|
||||||
"etc/permissions/com.android.vending.xml",
|
"etc/permissions/com.android.vending.xml",
|
||||||
|
"etc/permissions/foss-permissions.xml",
|
||||||
"etc/permissions/com.google.android.gms.xml",
|
"etc/permissions/com.google.android.gms.xml",
|
||||||
"etc/permissions/com.aurora.services.xml",
|
"etc/permissions/com.aurora.services.xml",
|
||||||
"etc/permissions/com.google.android.maps.xml",
|
"etc/permissions/com.google.android.maps.xml",
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,11 @@ from tools import container
|
||||||
|
|
||||||
class Nodataperm(General):
|
class Nodataperm(General):
|
||||||
id = "nodataperm"
|
id = "nodataperm"
|
||||||
dl_links = {"11": ["https://github.com/ayasa520/hack_full_data_permission/archive/refs/heads/main.zip",
|
dl_links = {
|
||||||
"eafd7b0986f3edaebaf1dd89f19d49bf"]}
|
"11": ["https://github.com/ayasa520/hack_full_data_permission/archive/refs/heads/main.zip",
|
||||||
|
"eafd7b0986f3edaebaf1dd89f19d49bf"],
|
||||||
|
"13": ["", ""]
|
||||||
|
}
|
||||||
dl_file_name = "nodataperm.zip"
|
dl_file_name = "nodataperm.zip"
|
||||||
extract_to = "/tmp/nodataperm"
|
extract_to = "/tmp/nodataperm"
|
||||||
dl_link = ...
|
dl_link = ...
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue