waydroid_script/stuffs/smartdock.py

45 lines
1.9 KiB
Python
Raw Normal View History

2023-01-21 10:50:03 -08:00
import os
import shutil
2023-01-22 18:20:20 -08:00
from time import sleep
2023-01-21 10:50:03 -08:00
from stuffs.general import General
2023-01-22 18:20:20 -08:00
from tools import container
from tools.helper import run
2023-01-21 10:50:03 -08:00
class Smartdock(General):
2023-04-29 08:00:42 -07:00
id = "smartdock"
2023-01-21 10:50:03 -08:00
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"
2023-01-22 18:20:20 -08:00
apply_props = { "qemu.hw.mainkeys" : "1" }
2023-01-26 07:23:50 -08:00
files = [
"etc/permissions/permissions_cu.axel.smartdock.xml",
"priv-app/SmartDock"
]
2023-04-29 08:00:42 -07:00
rc_content = '''
on property:sys.boot_completed=1
start set_home_activity
service set_home_activity /system/bin/sh -c "cmd package set-home-activity cu.axel.smartdock/.activities.LauncherActivity"
user root
group root
oneshot
'''
2023-01-21 10:50:03 -08:00
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"))
2023-01-22 18:20:20 -08:00
if not os.path.exists(os.path.join(self.copy_dir, self.partition, "etc", "permissions")):
os.makedirs(os.path.join(self.copy_dir, self.partition, "etc", "permissions"))
2023-01-21 10:50:03 -08:00
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"))
2023-04-29 08:00:42 -07:00
rc_dir = os.path.join(self.copy_dir, self.partition, "etc/init/smartdock.rc")
if not os.path.exists(os.path.dirname(rc_dir)):
os.makedirs(os.path.dirname(rc_dir))
with open(rc_dir, "w") as f:
f.write(self.rc_content)