Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aff0c512ab |
@@ -21,29 +21,45 @@ from stuff.fdroidpriv import FDroidPriv
|
|||||||
import tools.helper as helper
|
import tools.helper as helper
|
||||||
from tools import container
|
from tools import container
|
||||||
from tools import images
|
from tools import images
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
|
||||||
from tools.logger import Logger
|
from tools.logger import Logger
|
||||||
|
|
||||||
def get_certified():
|
|
||||||
|
def get_certified(args):
|
||||||
AndroidId().get_id()
|
AndroidId().get_id()
|
||||||
|
|
||||||
|
|
||||||
def mount(partition, copy_dir):
|
def mount(partition, copy_dir):
|
||||||
img = os.path.join(images.get_image_dir(), f"{partition}.img")
|
img = os.path.join(images.get_image_dir(), partition+".img")
|
||||||
mount_point = os.path.join(copy_dir) if partition == "system" else os.path.join(copy_dir, partition)
|
mount_point = ""
|
||||||
Logger.info(f"Mounting {img} to {mount_point}")
|
if partition == "system":
|
||||||
|
mount_point = os.path.join(copy_dir)
|
||||||
|
else:
|
||||||
|
mount_point = os.path.join(copy_dir, partition)
|
||||||
|
Logger.info("Mounting {} to {}".format(img, mount_point))
|
||||||
images.mount(img, mount_point)
|
images.mount(img, mount_point)
|
||||||
|
|
||||||
|
|
||||||
def resize(partition):
|
def resize(partition):
|
||||||
img = os.path.join(images.get_image_dir(), f"{partition}.img")
|
img = os.path.join(images.get_image_dir(), partition+".img")
|
||||||
img_size = int(os.path.getsize(img)/(1024*1024))
|
img_size = int(os.path.getsize(img)/(1024*1024))
|
||||||
new_size = f"{img_size + 500}M"
|
new_size = "{}M".format(img_size+500)
|
||||||
Logger.info(f"Resizing {img} to {new_size}")
|
Logger.info("Resizing {} to {}".format(img, new_size))
|
||||||
images.resize(img, new_size)
|
images.resize(img, new_size)
|
||||||
|
|
||||||
|
|
||||||
def umount(partition, copy_dir):
|
def umount(partition, copy_dir):
|
||||||
mount_point = os.path.join(copy_dir) if partition == "system" else os.path.join(copy_dir, partition)
|
mount_point = ""
|
||||||
Logger.info(f"Unmounting {mount_point}")
|
if partition == "system":
|
||||||
|
mount_point = os.path.join(copy_dir)
|
||||||
|
else:
|
||||||
|
mount_point = os.path.join(copy_dir, partition)
|
||||||
|
Logger.info("Umounting {}".format(mount_point))
|
||||||
images.umount(mount_point)
|
images.umount(mount_point)
|
||||||
|
|
||||||
|
|
||||||
def install_app(args):
|
def install_app(args):
|
||||||
install_list: List[General] = []
|
install_list: List[General] = []
|
||||||
app = args.app
|
app = args.app
|
||||||
@@ -102,6 +118,7 @@ def install_app(args):
|
|||||||
|
|
||||||
container.upgrade()
|
container.upgrade()
|
||||||
|
|
||||||
|
|
||||||
def remove_app(args):
|
def remove_app(args):
|
||||||
remove_list: List[General] = []
|
remove_list: List[General] = []
|
||||||
app = args.app
|
app = args.app
|
||||||
@@ -141,8 +158,10 @@ def remove_app(args):
|
|||||||
|
|
||||||
container.upgrade()
|
container.upgrade()
|
||||||
|
|
||||||
|
|
||||||
def hack_option(args):
|
def hack_option(args):
|
||||||
Logger.warning("If these hacks cause any problems, run `sudo python main.py remove <hack_option>` to remove")
|
Logger.warning(
|
||||||
|
"If these hacks cause any problems, run `sudo python main.py remove <hack_option>` to remove")
|
||||||
|
|
||||||
hack_list: List[General] = []
|
hack_list: List[General] = []
|
||||||
options = args.option_name
|
options = args.option_name
|
||||||
@@ -179,8 +198,10 @@ def hack_option(args):
|
|||||||
|
|
||||||
container.upgrade()
|
container.upgrade()
|
||||||
|
|
||||||
|
|
||||||
def interact():
|
def interact():
|
||||||
os.system("clear")
|
os.system("clear")
|
||||||
|
args = argparse.Namespace()
|
||||||
android_version = inquirer.select(
|
android_version = inquirer.select(
|
||||||
message="Select Android version",
|
message="Select Android version",
|
||||||
instruction="(\u2191\u2193 Select Item)",
|
instruction="(\u2191\u2193 Select Item)",
|
||||||
@@ -193,12 +214,15 @@ def interact():
|
|||||||
).execute()
|
).execute()
|
||||||
if not android_version:
|
if not android_version:
|
||||||
exit()
|
exit()
|
||||||
|
args.android_version = android_version
|
||||||
args = argparse.Namespace(android_version=android_version, microg_variant="Standard")
|
|
||||||
|
|
||||||
action = inquirer.select(
|
action = inquirer.select(
|
||||||
message="Please select an action",
|
message="Please select an action",
|
||||||
choices=["Install", "Remove", "Hack", "Get Google Device ID to Get Certified"],
|
choices=[
|
||||||
|
"Install",
|
||||||
|
"Remove",
|
||||||
|
"Hack",
|
||||||
|
"Get Google Device ID to Get Certified"
|
||||||
|
],
|
||||||
instruction="([↑↓]: Select Item)",
|
instruction="([↑↓]: Select Item)",
|
||||||
default=None,
|
default=None,
|
||||||
).execute()
|
).execute()
|
||||||
@@ -219,7 +243,8 @@ def interact():
|
|||||||
invalid_message="should be at least 1 selection",
|
invalid_message="should be at least 1 selection",
|
||||||
choices=install_choices
|
choices=install_choices
|
||||||
).execute()
|
).execute()
|
||||||
microg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"]
|
microg_variants = ["Standard", "NoGoolag",
|
||||||
|
"UNLP", "Minimal", "MinimalIAP"]
|
||||||
if "microg" in apps:
|
if "microg" in apps:
|
||||||
microg_variant = inquirer.select(
|
microg_variant = inquirer.select(
|
||||||
message="Select MicroG variant",
|
message="Select MicroG variant",
|
||||||
@@ -251,14 +276,15 @@ def interact():
|
|||||||
args.option_name = apps
|
args.option_name = apps
|
||||||
hack_option(args)
|
hack_option(args)
|
||||||
elif action == "Get Google Device ID to Get Certified":
|
elif action == "Get Google Device ID to Get Certified":
|
||||||
get_certified()
|
AndroidId().get_id()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
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!''')
|
||||||
|
|
||||||
subparsers = parser.add_subparsers(title="command", dest='command')
|
subparsers = parser.add_subparsers(title="coomand", dest='command')
|
||||||
parser.add_argument('-a', '--android-version',
|
parser.add_argument('-a', '--android-version',
|
||||||
dest='android_version',
|
dest='android_version',
|
||||||
help='Specify the Android version',
|
help='Specify the Android version',
|
||||||
@@ -270,7 +296,8 @@ def main():
|
|||||||
'certified', help='Get device ID to obtain Play Store certification')
|
'certified', help='Get device ID to obtain Play Store certification')
|
||||||
certified.set_defaults(func=get_certified)
|
certified.set_defaults(func=get_certified)
|
||||||
|
|
||||||
install_choices = ["gapps", "microg", "libndk", "libhoudini", "magisk", "mitm", "smartdock", "widevine"]
|
install_choices = ["gapps", "microg", "libndk", "libhoudini",
|
||||||
|
"magisk", "mitm", "smartdock", "widevine"]
|
||||||
hack_choices = ["nodataperm", "hidestatusbar"]
|
hack_choices = ["nodataperm", "hidestatusbar"]
|
||||||
micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"]
|
micrg_variants = ["Standard", "NoGoolag", "UNLP", "Minimal", "MinimalIAP"]
|
||||||
remove_choices = install_choices
|
remove_choices = install_choices
|
||||||
@@ -279,6 +306,7 @@ def main():
|
|||||||
"dest": "app",
|
"dest": "app",
|
||||||
"type": str,
|
"type": str,
|
||||||
"nargs": '+',
|
"nargs": '+',
|
||||||
|
# "metavar":"",
|
||||||
}
|
}
|
||||||
|
|
||||||
install_help = """
|
install_help = """
|
||||||
@@ -316,12 +344,15 @@ widevine: Add support for widevine DRM L3
|
|||||||
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)
|
||||||
helper.check_root()
|
helper.check_root()
|
||||||
args.func(args)
|
args.func(args)
|
||||||
else:
|
else:
|
||||||
helper.check_root()
|
helper.check_root()
|
||||||
interact()
|
interact()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ def use_overlayfs():
|
|||||||
cfg = configparser.ConfigParser()
|
cfg = configparser.ConfigParser()
|
||||||
cfg_file = os.environ.get("WAYDROID_CONFIG", "/var/lib/waydroid/waydroid.cfg")
|
cfg_file = os.environ.get("WAYDROID_CONFIG", "/var/lib/waydroid/waydroid.cfg")
|
||||||
if not os.path.isfile(cfg_file):
|
if not os.path.isfile(cfg_file):
|
||||||
Logger.error("Cannot locate waydroid config file, reinit wayland and try again!")
|
Logger.error("Cannot locate waydroid config file, reinit waydroid and try again!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
cfg.read(cfg_file)
|
cfg.read(cfg_file)
|
||||||
if "waydroid" not in cfg:
|
if "waydroid" not in cfg:
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ def get_image_dir():
|
|||||||
cfg = configparser.ConfigParser()
|
cfg = configparser.ConfigParser()
|
||||||
cfg_file = os.environ.get("WAYDROID_CONFIG", "/var/lib/waydroid/waydroid.cfg")
|
cfg_file = os.environ.get("WAYDROID_CONFIG", "/var/lib/waydroid/waydroid.cfg")
|
||||||
if not os.path.isfile(cfg_file):
|
if not os.path.isfile(cfg_file):
|
||||||
Logger.error("Cannot locate waydroid config file, reinit wayland and try again!")
|
Logger.error("Cannot locate waydroid config file, reinit waydroid and try again!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
cfg.read(cfg_file)
|
cfg.read(cfg_file)
|
||||||
if "waydroid" not in cfg:
|
if "waydroid" not in cfg:
|
||||||
|
|||||||
Reference in New Issue
Block a user