diff --git a/api/README.md b/api/README.md index 41cbdf5..8630a4e 100644 --- a/api/README.md +++ b/api/README.md @@ -13,6 +13,7 @@ | websize | 程序官网 | | home | 用户 home(用户文件)目录 | | developer | 参与的开发者列表 | +| language | 当前语言 | | DesktopPath() | (函数)用户桌面目录 | ## Check @@ -46,7 +47,7 @@ xxx = api.APK("APK 所在路径") | xxx.version() | 获取 APK 版本号 | | xxx.saveDesktopFile("图标保存路径", "快捷方式保存路径") | 保存支持 UEngine 启动的 APK 快捷方式 | | xxx.run() | 运行该应用(需要保证已经安装) | -| xxx.buildDeb("deb 包保存路径", qianZhui) | 打包为 deb 包(“qianZhui”是布尔值,True代表有前缀为“uengine-dc”,False代表没有前缀) | +| xxx.buildDeb("deb 包保存路径", qianZhui) | 打包为 deb 包(“qianZhui”是布尔值,可略,True代表有前缀为“uengine-dc”,False代表没有前缀) | ## UEngine 用于对 UEngine 进行一点点操控,详细如下: @@ -57,6 +58,9 @@ xxx = api.APK("APK 所在路径") | UengineDataClean() | 清空 UEngine 数据(需要 Root) | | RemoveUengineCheck() | 删除 UEngine 的检查脚本(需要 Root) | | CPUCheck() | 检查 CPU 是否支持运行 UEngine | +| BuildUengineRootImage() | 构建 UEngine 的 Root 镜像 | +| OpenUengineRootData() | 打开 UEngine 数据目录 | +| InstallRootUengineImage() | 安装已经被 Root 过的 UEngine 镜像(需要 Root) | | Services | 用于操控 UEngine 服务的类,见下(需要 Root) | | InternetBridge | 用于操控 UEngine 网络桥接的类,见下(需要 Root) | ### Services @@ -96,4 +100,10 @@ xxx = api.File("文件所在路径") | 函数名 | 函数介绍 | |:-:|:-:| | xxx.read() | 读取这个文件 | -| xxx.write("写入内容") | 写入这个文件 | \ No newline at end of file +| xxx.write("写入内容") | 写入这个文件 | + +## UengineRunner +用于 UEngine 运行器的部分操控(请保证安装了 UEngine 运行器) +| 函数名 | 函数介绍 | +|:-:|:-:| +| CleanHistory() | 清理 UEngine 运行器的历史记录 | \ No newline at end of file diff --git a/api/__init__.py b/api/__init__.py index 623ae8b..2404a76 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -12,7 +12,8 @@ class ProgramInformation: updateTime = "2022年05月21日" websize = ["https://gitee.com/gfdgd-xi/uengine-runner", "https://github.com/gfdgd-xi/uengine-runner"] home = os.path.expanduser('~') - developer = ["gfdgd xi", "为什么您不喜欢熊出没和阿布呢"] + developer = ["gfdgd xi<3025613752@qq.com>", "为什么您不喜欢熊出没和阿布呢", "星空露光", "actionchen<917981399@qq.com>", "柚子"] + lang = os.getenv('LANG') # 获取用户桌面目录 def DesktopPath() -> "获取用户桌面目录": for line in open(get_home() + "/.config/user-dirs.dirs"): # 以行来读取配置文件 @@ -289,6 +290,15 @@ class UEngine: os.remove("/usr/share/uengine/uengine-check-runnable.sh") def CPUCheck(): return subprocess.getoutput("uengine check-features") + def BuildUengineRootImage(): + os.system(ProgramInformation.programPath + "/root-uengine.sh") + def OpenUengineRootData(): + os.system("xdg-open /data/uengine/data/data") + def InstallRootUengineImage(): + if not os.path.exists: + os.mkdir("/tmp/uengine-runner") + File("/tmp/uengine-runner/install.sh").write("sudo dpkg -i /tmp/uengine-runner/u*.deb\nsudo apt install -f") + os.system("wget -P '/tmp/uengine-runner' 'https://hub.fastgit.org/gfdgd-xi/uengine-runner/releases/download/U1.1.14/uengine-android-image_1.1.14_amd64.deb' && pkexec bash '/tmp/uengine-runner/install.sh'") class Services: def Open(): os.system("pkexec systemctl enable uengine-container uengine-session && systemctl start uengine-container uengine-session") @@ -296,7 +306,6 @@ class UEngine: os.system("pkexec systemctl disable uengine-container uengine-session") def Restart(): os.system("pkexec systemctl restart uengine*") - class InternetBridge: def Open(): os.system("pkexec uengine-bridge.sh start") @@ -321,13 +330,11 @@ class Adb: class File: def __init__(self, filePath): self.filePath = filePath - def read(self): f = open(self.filePath, "r") # 设置文件对象 str = f.read() # 获取内容 f.close() # 关闭文本对象 return str # 返回结果 - def write(self, things) -> "写入文本文档": TxtDir = os.path.dirname(self.filePath) print(TxtDir) @@ -337,6 +344,10 @@ class File: file.write(things) # 写入文本 file.close() # 关闭文本对象 +class UengineRunner: + def CleanHistory(): + shutil.rmtree(ProgramInformation.home + "/.config/uengine-runner") + if __name__ == "__main__": print("本 API 不支持直接运行,请通过引入的方式使用此 API") apki = APK("/home/gfdgd_xi/下载/60D3B51B76CCAC313B3F0809FD1A64FD.apk") diff --git a/api/root-uengine.sh b/api/root-uengine.sh new file mode 100755 index 0000000..896b42d --- /dev/null +++ b/api/root-uengine.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +#sudo apt install squashfs-tools + +mkdir -p ~/temp +cd ~/temp +echo "正在下载supersu" +wget -P ~/temp http://supersuroot.org/downloads/SuperSU-v2.82-201705271822.zip +cd .. +mkdir -p ~/temp/work/dabao/extract/DEBIAN +echo "正在解压supersu" +unzip ~/temp/SuperSU-v2.82-201705271822.zip -d ~/temp/work/su +WORKDIR=~/temp/work +cd "$WORKDIR" +echo "正在下载uengine-android-image" +apt download uengine-android-image +echo "正在解压uengine-android-image" +cd dabao +dpkg-deb -x $WORKDIR/uengine-android-image*.deb extract/ +dpkg-deb -e $WORKDIR/uengine-android-image*.deb extract/DEBIAN +cd .. +cp dabao/extract/usr/share/uengine/android.img android.img + +echo "正在解压android镜像" +sudo unsquashfs android.img + +sudo mkdir -p ./squashfs-root/system/app/SuperSU +sudo mkdir -p ./squashfs-root/system/bin/.ext/ + +echo "正在将supersu安装到android镜像" +sudo cp ./su/common/Superuser.apk ./squashfs-root/system/app/SuperSU/SuperSU.apk +sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/etc/install-recovery.sh +sudo cp ./su/common/install-recovery.sh ./squashfs-root/system/bin/install-recovery.sh +sudo cp ./su/x64/su ./squashfs-root/system/xbin/su +sudo cp ./su/x64/su ./squashfs-root/system/bin/.ext/.su +sudo cp ./su/x64/su ./squashfs-root/system/xbin/daemonsu +sudo cp ./su/x64/supolicy ./squashfs-root/system/xbin/supolicy +sudo cp ./su/x64/libsupol.so ./squashfs-root/system/lib64/libsupol.so +sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process_init +sudo cp ./squashfs-root/system/bin/app_process64 ./squashfs-root/system/bin/app_process64_original +sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process +sudo cp ./squashfs-root/system/xbin/daemonsu ./squashfs-root/system/bin/app_process64 + +sudo chmod +x ./squashfs-root/system/app/SuperSU/SuperSU.apk +sudo chmod +x ./squashfs-root/system/etc/install-recovery.sh +sudo chmod +x ./squashfs-root/system/bin/install-recovery.sh +sudo chmod +x ./squashfs-root/system/xbin/su +sudo chmod +x ./squashfs-root/system/bin/.ext/.su +sudo chmod +x ./squashfs-root/system/xbin/daemonsu +sudo chmod +x ./squashfs-root/system/xbin/supolicy +sudo chmod +x ./squashfs-root/system/lib64/libsupol.so +sudo chmod +x ./squashfs-root/system/bin/app_process_init +sudo chmod +x ./squashfs-root/system/bin/app_process64_original +sudo chmod +x ./squashfs-root/system/bin/app_process +sudo chmod +x ./squashfs-root/system/bin/app_process64 + +echo "正在打包android镜像" +sudo rm android.img +sudo mksquashfs squashfs-root android.img -b 131072 -comp xz -Xbcj ia64 + + +cp android.img dabao/extract/usr/share/uengine/android.img + +echo "正在打包uengine-android-image" +cd dabao/extract +find usr -type f -print0 |xargs -0 md5sum >md5sums +cd .. +mkdir build +dpkg-deb -b extract/ build/ + +cp build/*.deb ~/ + +echo "正在清理垃圾" +sudo rm -rf ~/temp + +echo "已在用户主目录生成新的安装包,安装后重启即可生效" \ No newline at end of file diff --git a/information-new.json b/information-new.json index 940fd37..98805d6 100755 --- a/information-new.json +++ b/information-new.json @@ -149,6 +149,8 @@ "Contribute": [ "gfdgd xi<3025613752@qq.com>", "actionchen<917981399@qq.com>", - "柚子" + "柚子", + "为什么您不喜欢熊出没和阿布呢", + "星空露光" ] } \ No newline at end of file diff --git a/information.json b/information.json index 2468f07..2cdfeab 100755 --- a/information.json +++ b/information.json @@ -149,6 +149,8 @@ "Contribute": [ "gfdgd xi<3025613752@qq.com>", "actionchen<917981399@qq.com>", - "柚子" + "柚子", + "为什么您不喜欢熊出没和阿布呢", + "星空露光" ] } \ No newline at end of file