Uninstall function, microG installation and some hacks #70

Merged
ayasa520 merged 42 commits from main into main 2023-05-28 02:54:02 -04:00
11 changed files with 96 additions and 62 deletions
Showing only changes of commit 59ad317684 - Show all commits
+1
View File
@@ -104,3 +104,4 @@ venv.bak/
# mypy # mypy
.mypy_cache/ .mypy_cache/
test.py
+54 -38
View File
@@ -5,59 +5,75 @@ from stuffs.gapps import Gapps
from stuffs.houdini import Houdini from stuffs.houdini import Houdini
from stuffs.magisk import Magisk from stuffs.magisk import Magisk
from stuffs.ndk import Ndk from stuffs.ndk import Ndk
from stuffs.smartdock import Smartdock
from stuffs.widevine import Widevine from stuffs.widevine import Widevine
import tools.helper as helper import tools.helper as helper
def install(*args):
if "gapps" in args:
def main():
about = """
WayDroid Helper script v0.3
Does stuff like installing Gapps, Installing NDK Translation and getting Android ID for device registration.
Use -h flag for help !
"""
parser = argparse.ArgumentParser(description=about, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-g', '--install-gapps',
dest='gapps',
help='Install OpenGapps to waydroid',
action='store_true')
parser.add_argument('-n', '--install-ndk-translation',
dest='ndk',
help='Install libndk translation for arm translation',
action='store_true')
parser.add_argument('-i', '--get-android-id', dest='getid',
help='Displays your android id for manual registration',
action='store_true')
parser.add_argument('-m', '--install-magisk', dest='magisk',
help='Attempts to install Magisk ( Bootless )',
action='store_true')
parser.add_argument('-l', '--install-libhoudini', dest='houdini',
help='Install libhoudini for arm translation',
action='store_true')
parser.add_argument('-w', '--install-widevine', dest='widevine',
help='Integrate Widevine DRM (L3)',
action='store_true')
args = parser.parse_args()
helper.check_root()
if args.getid:
Android_id().get_id()
if args.gapps:
Gapps().install() Gapps().install()
if args.ndk and not args.houdini: if "libndk" in args and "houdini" not in args:
arch = helper.host()[0] arch = helper.host()[0]
if arch == "x86_64": if arch == "x86_64":
Ndk().install() Ndk().install()
else: else:
Logger.warn("libndk is not supported on your CPU") Logger.warn("libndk is not supported on your CPU")
if args.houdini and not args.ndk: if "libhoudini" in args and "ndk" not in args:
arch = helper.host()[0] arch = helper.host()[0]
if arch == "x86_64": if arch == "x86_64":
Houdini().install() Houdini().install()
else: else:
Logger.warn("libhoudini is not supported on your CPU") Logger.warn("libhoudini is not supported on your CPU")
if args.magisk: if "magisk" in args:
Magisk().install() Magisk().install()
if args.widevine: if "widevine" in args:
Widevine().install() Widevine().install()
if "smartdock" in args :
Smartdock().install()
def uninstall(*args):
pass
def main():
about = """
WayDroid Helper script v0.3
Does stuff like installing Gapps, installing Magisk, installing NDK Translation and getting Android ID for device registration.
Use -h flag for help!
"""
helper.check_root()
parser = argparse.ArgumentParser(prog=about)
parser.set_defaults(app="")
subparsers = parser.add_subparsers(title="subcommands", help="operations")
google_id_parser=subparsers.add_parser('google',
help='grab device id for unblocking Google Apps')
google_id_parser.set_defaults(func=Android_id().get_id)
# create the parser for the "a" command
arg_template = {
"dest": "app",
"type": str,
"nargs": '+',
"choices": ["gapps", "libndk","libhoudini","magisk", "smartdock","widevine"],
}
install_parser = subparsers.add_parser("install", help='install something')
install_parser.set_defaults(func=install)
install_parser.add_argument(**arg_template)
uninstall_parser = subparsers.add_parser("uninstall", help='uninstall something')
uninstall_parser.set_defaults(func=uninstall)
uninstall_parser.add_argument(**arg_template)
args = parser.parse_args()
if args.app:
args.func(*args.app)
else:
args.func()
if __name__ == "__main__": if __name__ == "__main__":
main() main()
-4
View File
@@ -27,10 +27,6 @@ class Gapps(General):
"setupwizardtablet-x86_64.tar.lz" "setupwizardtablet-x86_64.tar.lz"
] ]
def download(self):
Logger.info("Downloading OpenGapps now to {} .....".format(self.download_loc))
super().download()
def copy(self): def copy(self):
if not os.path.exists(self.extract_to): if not os.path.exists(self.extract_to):
os.makedirs(self.extract_to) os.makedirs(self.extract_to)
+12
View File
@@ -9,6 +9,10 @@ from tools.container import DBusContainerService
from tools.logger import Logger from tools.logger import Logger
class General: class General:
@property
def skip_extract(self):
return False
@property @property
def download_loc(self): def download_loc(self):
return os.path.join(get_download_dir(), self.dl_file_name) return os.path.join(get_download_dir(), self.dl_file_name)
@@ -37,6 +41,7 @@ class General:
return False return False
def download(self): def download(self):
Logger.info("Downloading {} now to {} .....".format(self.dl_file_name, self.download_loc))
loc_md5 = "" loc_md5 = ""
if os.path.isfile(self.download_loc): if os.path.isfile(self.download_loc):
with open(self.download_loc, "rb") as f: with open(self.download_loc, "rb") as f:
@@ -113,21 +118,28 @@ class General:
def copy(self): def copy(self):
pass pass
def extra(self):
pass
def install(self): def install(self):
if self.use_overlayfs: if self.use_overlayfs:
self.download() self.download()
if not self.skip_extract:
self.extract() self.extract()
self.copy() self.copy()
self.extra()
if hasattr(self, "apply_props"): if hasattr(self, "apply_props"):
self.add_props() self.add_props()
self.restart() self.restart()
else: else:
self.stop() self.stop()
self.download() self.download()
if not self.skip_extract:
self.extract() self.extract()
self.resize() self.resize()
self.mount() self.mount()
self.copy() self.copy()
self.extra()
if hasattr(self, "apply_props"): if hasattr(self, "apply_props"):
self.add_props() self.add_props()
self.umount() self.umount()
-4
View File
@@ -32,10 +32,6 @@ on property:ro.enable.native.bridge.exec=1
"ro.dalvik.vm.isa.arm64": "x86_64" "ro.dalvik.vm.isa.arm64": "x86_64"
} }
def download(self):
Logger.info("Downloading libhoudini to {}now .....".format(self.download_loc))
super().download()
def copy(self): def copy(self):
run(["chmod", "+x", self.extract_to, "-R"]) run(["chmod", "+x", self.extract_to, "-R"])
Logger.info("Copying libhoudini library files ...") Logger.info("Copying libhoudini library files ...")
-4
View File
@@ -32,10 +32,6 @@ on property:ro.enable.native.bridge.exec=1
copy /system/etc/binfmt_misc/arm64_dyn /proc/sys/fs/binfmt_misc/register copy /system/etc/binfmt_misc/arm64_dyn /proc/sys/fs/binfmt_misc/register
""" """
def download(self):
Logger.info("Downloading libndk to {} now .....".format(self.download_loc))
super().download()
def copy(self): def copy(self):
run(["chmod", "+x", self.extract_to, "-R"]) run(["chmod", "+x", self.extract_to, "-R"])
Logger.info("Copying libndk library files ...") Logger.info("Copying libndk library files ...")
+21
View File
@@ -0,0 +1,21 @@
import os
import shutil
from stuffs.general import General
class Smartdock(General):
dl_link = "https://github.com/ayasa520/smartdock/releases/download/v1.9.6/smartdock.zip"
partition = "system"
extract_to = "/tmp/smartdockunpack"
dl_file_name = "smartdock.zip"
act_md5 = "ad0cc5e023ac6ee97e7b013b9b0defee"
def copy(self):
if not os.path.exists(os.path.join(self.copy_dir, self.partition, "priv-app", "SmartDock")):
os.makedirs(os.path.join(self.copy_dir, self.partition, "priv-app", "SmartDock"))
shutil.copyfile(os.path.join(self.extract_to, "app-release.apk"),
os.path.join(self.copy_dir, self.partition, "priv-app", "SmartDock", "smartdock.apk"))
shutil.copyfile(os.path.join(self.extract_to, "permissions_cu.axel.smartdock.xml"),
os.path.join(self.copy_dir, self.partition, "etc", "permissions", "permissions_cu.axel.smartdock.xml"))
def extra(self):
return super().extra()
-4
View File
@@ -12,10 +12,6 @@ class Widevine(General):
extract_to = "/tmp/widevineunpack" extract_to = "/tmp/widevineunpack"
act_md5 = "a31f325453c5d239c21ecab8cfdbd878" act_md5 = "a31f325453c5d239c21ecab8cfdbd878"
def download(self):
Logger.info("Downloading widevine to {} now .....".format(self.download_loc))
super().download()
def copy(self): def copy(self):
run(["chmod", "+x", self.extract_to, "-R"]) run(["chmod", "+x", self.extract_to, "-R"])
Logger.info("Copying widevine library files ...") Logger.info("Copying widevine library files ...")