waydroid_script/stuffs/smartdock.py

44 lines
1.9 KiB
Python
Raw Normal View History

2023-01-21 10:50:03 -08:00
import os
import shutil
from stuffs.general import General
class Smartdock(General):
2023-04-29 08:00:42 -07:00
id = "smartdock"
2023-04-30 14:03:24 -07:00
dl_link = "https://github.com/ayasa520/smartdock/releases/download/v1.9.7/smartdock.zip"
2023-01-21 10:50:03 -08:00
partition = "system"
extract_to = "/tmp/smartdockunpack"
dl_file_name = "smartdock.zip"
2023-04-30 14:05:13 -07:00
act_md5 = "912e00189c562505114cce62c7aa9478"
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",
2023-04-30 14:03:24 -07:00
"priv-app/SmartDock",
"etc/init/smartdock.rc"
2023-01-26 07:23:50 -08:00
]
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"),
2023-04-30 14:03:24 -07:00
os.path.join(self.copy_dir, self.partition, "priv-app/SmartDock/smartdock.apk"))
2023-01-21 10:50:03 -08:00
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))
2023-04-30 14:03:24 -07:00
self.extract_app_lib(os.path.join(self.copy_dir, self.partition, "priv-app/SmartDock/smartdock.apk"))
2023-04-29 08:00:42 -07:00
with open(rc_dir, "w") as f:
f.write(self.rc_content)