install smart dock
This commit is contained in:
@@ -104,3 +104,4 @@ venv.bak/
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
test.py
|
||||
@@ -5,59 +5,75 @@ from stuffs.gapps import Gapps
|
||||
from stuffs.houdini import Houdini
|
||||
from stuffs.magisk import Magisk
|
||||
from stuffs.ndk import Ndk
|
||||
from stuffs.smartdock import Smartdock
|
||||
from stuffs.widevine import Widevine
|
||||
import tools.helper as helper
|
||||
|
||||
|
||||
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:
|
||||
def install(*args):
|
||||
if "gapps" in args:
|
||||
Gapps().install()
|
||||
if args.ndk and not args.houdini:
|
||||
if "libndk" in args and "houdini" not in args:
|
||||
arch = helper.host()[0]
|
||||
if arch == "x86_64":
|
||||
Ndk().install()
|
||||
else:
|
||||
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]
|
||||
if arch == "x86_64":
|
||||
Houdini().install()
|
||||
else:
|
||||
Logger.warn("libhoudini is not supported on your CPU")
|
||||
if args.magisk:
|
||||
if "magisk" in args:
|
||||
Magisk().install()
|
||||
if args.widevine:
|
||||
if "widevine" in args:
|
||||
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__":
|
||||
main()
|
||||
|
||||
@@ -27,10 +27,6 @@ class Gapps(General):
|
||||
"setupwizardtablet-x86_64.tar.lz"
|
||||
]
|
||||
|
||||
def download(self):
|
||||
Logger.info("Downloading OpenGapps now to {} .....".format(self.download_loc))
|
||||
super().download()
|
||||
|
||||
def copy(self):
|
||||
if not os.path.exists(self.extract_to):
|
||||
os.makedirs(self.extract_to)
|
||||
|
||||
@@ -9,6 +9,10 @@ from tools.container import DBusContainerService
|
||||
from tools.logger import Logger
|
||||
|
||||
class General:
|
||||
@property
|
||||
def skip_extract(self):
|
||||
return False
|
||||
|
||||
@property
|
||||
def download_loc(self):
|
||||
return os.path.join(get_download_dir(), self.dl_file_name)
|
||||
@@ -37,6 +41,7 @@ class General:
|
||||
return False
|
||||
|
||||
def download(self):
|
||||
Logger.info("Downloading {} now to {} .....".format(self.dl_file_name, self.download_loc))
|
||||
loc_md5 = ""
|
||||
if os.path.isfile(self.download_loc):
|
||||
with open(self.download_loc, "rb") as f:
|
||||
@@ -113,21 +118,28 @@ class General:
|
||||
def copy(self):
|
||||
pass
|
||||
|
||||
def extra(self):
|
||||
pass
|
||||
|
||||
def install(self):
|
||||
if self.use_overlayfs:
|
||||
self.download()
|
||||
if not self.skip_extract:
|
||||
self.extract()
|
||||
self.copy()
|
||||
self.extra()
|
||||
if hasattr(self, "apply_props"):
|
||||
self.add_props()
|
||||
self.restart()
|
||||
else:
|
||||
self.stop()
|
||||
self.download()
|
||||
if not self.skip_extract:
|
||||
self.extract()
|
||||
self.resize()
|
||||
self.mount()
|
||||
self.copy()
|
||||
self.extra()
|
||||
if hasattr(self, "apply_props"):
|
||||
self.add_props()
|
||||
self.umount()
|
||||
|
||||
@@ -32,10 +32,6 @@ on property:ro.enable.native.bridge.exec=1
|
||||
"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):
|
||||
run(["chmod", "+x", self.extract_to, "-R"])
|
||||
Logger.info("Copying libhoudini library files ...")
|
||||
|
||||
@@ -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
|
||||
"""
|
||||
|
||||
def download(self):
|
||||
Logger.info("Downloading libndk to {} now .....".format(self.download_loc))
|
||||
super().download()
|
||||
|
||||
def copy(self):
|
||||
run(["chmod", "+x", self.extract_to, "-R"])
|
||||
Logger.info("Copying libndk library files ...")
|
||||
|
||||
@@ -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()
|
||||
@@ -12,10 +12,6 @@ class Widevine(General):
|
||||
extract_to = "/tmp/widevineunpack"
|
||||
act_md5 = "a31f325453c5d239c21ecab8cfdbd878"
|
||||
|
||||
def download(self):
|
||||
Logger.info("Downloading widevine to {} now .....".format(self.download_loc))
|
||||
super().download()
|
||||
|
||||
def copy(self):
|
||||
run(["chmod", "+x", self.extract_to, "-R"])
|
||||
Logger.info("Copying widevine library files ...")
|
||||
|
||||
Reference in New Issue
Block a user