diff --git a/WebSize/index.html b/WebSize/index.html index d512923..0711e9e 100644 --- a/WebSize/index.html +++ b/WebSize/index.html @@ -2,5 +2,6 @@ UEngine 运行器 -

Hello World!

+

UEngine 运行器下载链接:

+

https://gitee.com/gfdgd-xi-org/uengine-runner/releases

\ No newline at end of file diff --git a/com.gitee.uengine.runner.spark.deb b/com.gitee.uengine.runner.spark.deb new file mode 100644 index 0000000..5e46eaa Binary files /dev/null and b/com.gitee.uengine.runner.spark.deb differ diff --git a/new-deb-build/DEBIAN/control b/new-deb-build/DEBIAN/control index 040fc4e..2da8f8f 100755 --- a/new-deb-build/DEBIAN/control +++ b/new-deb-build/DEBIAN/control @@ -1,7 +1,7 @@ Package: com.gitee.uengine.runner.spark Source: com.gitee.uengine.runner.spark Replaces: spark-uengine-runner, com.gitee.uengine.runner.spark.ubuntu -Version: 1.8.3-uos +Version: 2.0.0 Architecture: all Section: utils Installed-Size: 1544 diff --git a/new-deb-build/DEBIAN/postinst b/new-deb-build/DEBIAN/postinst index 55b1af3..9650244 100755 --- a/new-deb-build/DEBIAN/postinst +++ b/new-deb-build/DEBIAN/postinst @@ -18,6 +18,7 @@ ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-launch.sh /usr/bin/uengine-runner-launch.sh ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug /usr/bin/uengine-runner-update-bug ln -s /opt/apps/com.gitee.uengine.runner.spark/files/root-uengine /usr/bin/uengine-root +ln -s /opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/main.py /usr/bin/uengine-runner-auto-install-bash ln -s /opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-applist-launch.sh /usr/bin/uengine-runner-applist-launch.sh # 刷新图标缓存 # 因为 Ubuntu 的问题,省略 diff --git a/new-deb-build/DEBIAN/postrm b/new-deb-build/DEBIAN/postrm index dcc6207..3738e06 100755 --- a/new-deb-build/DEBIAN/postrm +++ b/new-deb-build/DEBIAN/postrm @@ -1,4 +1,11 @@ -#!/bin/sh +#!/bin/bash +# 使用系统默认的 bash 运行 +################################################################################################################# +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 版本:2.0.0 +# 更新时间:2022年01月16日 +# 基于 bash +################################################################################################################# # 删除软链接 rm -f /usr/bin/uengine-runner rm -f /usr/bin/uengine-apk-builder @@ -14,6 +21,12 @@ rm -f /usr/bin/uengine-root rm -fr /opt/apps/com.gitee.uengine.runner.spark/files/api/__pycache__ rm -fr /opt/apps/com.gitee.uengine.runner.spark/files/__pycache__ rm -f /usr/bin/uengine-runner-applist-launch.sh +rm -f /usr/bin/uengine-runner-auto-install-bash +# 删除软件残留,简单粗暴一点直接全部删掉,防止出现警告 +# 加判断是为了怕 reinstall 后程序就再也打不开了(除非卸载后重新安装) +if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then + rm -rf /opt/apps/com.gitee.uengine.runner.spark +fi # 删除软件配置文件(只限“purge”) # 配置目录:~/.config/uengine-runner if [ "$1" = "purge" ]; then diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/download b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/download new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/download @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/error b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/error new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/error @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/info b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/info new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/info @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/installapk b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/installapk new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/installapk @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/pause b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/pause new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/pause @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/programforum b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/programforum new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/programforum @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/thank b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/thank new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/thank @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/version b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/version new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/version @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/warning b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/warning new file mode 100755 index 0000000..b766ea2 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/command/warning @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# 加入路径 +import os +import sys +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +sys.path.append(f"{programPath}/../../") +import ConfigLanguareRunner +# 符号转移 +argv = [] +for i in sys.argv[1:]: + argv.append(i.replace(" ", "\\ ")) +com = ConfigLanguareRunner.Command(f"{os.path.basename(sys.argv[0])} {' '.join(argv)}") +com.Run(com.GetCommandList(), os.getenv("WINEPREFIX"), os.getenv("WINE")) +sys.exit(int(ConfigLanguareRunner.programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/main.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/main.py new file mode 100755 index 0000000..4e4b82f --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/AutoShell/main.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python3 +import os +import sys +import time +import json +import platform + +# 读取文本文档 +def readtxt(path): + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +information = json.loads(readtxt(f"{programPath}/../information.json")) +version = information["Version"] +thankText = "" +for i in information["Contribute"]: + thankText += f"{i}\n" +programEnv = [ + ["WINEPREFIX", f"{os.path.expanduser('~')}/.wine"], + ["WINE", "deepin-wine6-stable"], + ["DANGER", "0"], + ["PROGRAMPATH", programPath], + ["VERSION", version], + ["THANK", thankText.replace("\n", "\\n")], + ["MAKER", "gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["COPYRIGHT", f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["PLATFORM", platform.system()], + ["DEBUG", str(int("--debug" in sys.argv))] +] +'''programEnv = [ + ["($WINEPREFIX)", f"{os.path.expanduser('~')}/.wine"], + ["($WINE)", "deepin-wine6-stable"], + ["($DANGER)", "0"], + ["($HOME)", os.path.expanduser('~')], + ["($PROGRAMPATH)", programPath], + ["($VERSION)", version], + ["($THANK)", thankText], + ["($MAKER)", "gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["($COPYRIGHT)", f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["?", "0"], + ["PLATFORM)", platform.system()], + ["DEBUG)", str(int("--debug" in sys.argv))] +]''' +optionAll = 0 +if "--debug" in sys.argv: + optionAll += 1 +if "--system" in sys.argv: + programEnv.append(["DANGER", "1"]) + optionAll += 1 +if os.getenv("WINE") != None: + programEnv.append(["WINE", os.getenv("WINE")]) +if os.getenv("WINEPREFIX") != None: + programEnv.append(["WINEPREFIX", os.getenv("WINEPREFIX")]) +# 生成可以使用的参数 +commandEnv = "" +for i in programEnv: + commandEnv += f"{i[0]}=\"{i[1]}\" " +commandEnv += f"PATH=\"{programPath}/command:$PATH\" " +if len(sys.argv) - optionAll < 2: + print("Wine 运行器自动配置文件解析器交互环境(基于 Bash)") + print(f"版本:{version}") + print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("--------------------------------------------------------------") + os.system(f"{commandEnv} bash ") + exit() +command = "" +for i in sys.argv[1:]: + command += f"\"{i}\" " +print("Wine 运行器自动配置文件解析器(基于 Bash)") +print(f"版本:{version}") +print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢") +print("--------------------------------------------------------------") +os.system(f"{commandEnv} bash {command}") \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ConfigLanguareRunner-help.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ConfigLanguareRunner-help.json new file mode 100644 index 0000000..e7f594c --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ConfigLanguareRunner-help.json @@ -0,0 +1,46 @@ +{ + "installdll": "安装指定 dll 在指定容器\n参数数量:1\n参数介绍:dll名称或在从互联网获取DLL工具的编号,如 7012 xolehlp.dll 平台:2003 架构:64 的 7012", + "stopdll": "不允许指定 dll/exe 运行\n参数数量:1\n参数介绍:dll/exe 名称,如 example.exe", + "installfont": "安装指定字体到指定容器\n参数数量:1\n在字体商店的编号,如 5 msyhbd.ttc 的 5", + "installsparkcorefont": "安装星火应用商店的“微软核心字体”\n参数数量:0\n参数介绍:无", + "installmono": "安装最新版本的 mono 到指定容器\n参数数量:0\n参数介绍:无", + "installgecko": "安装最新版本的 gecko 到指定容器\n参数数量:0\n参数介绍:无", + "installvcpp": "安装指定的 VCPP 运行库到指定容器\n参数数量:1\n参数介绍:在安装 Visual Studio C++ 工具的编号,如 10 Visual Studio C++ 2015、2017、2019 和 2022 X64 的 10", + "installnet": "安装指定的 .net framework 运行库到指定容器\n参数数量:1\n参数介绍:在安装 .net framework 工具的编号,如 3 .net framework 4.5.1 Offline Installer 的 3", + "installmsxml": "安装指定的 MSXML 运行库到指定容器\n参数数量:1\n参数介绍:在安装 MSXML 工具的编号,如 1、MSXML 4.0 SP3 的 1", + "echo": "显示内容\n参数数量:≥1\n参数介绍:接要显示的内容", + "info": "显示提示对话框\n参数数量:2\n参数介绍:标题+显示内容", + "error": "显示错误对话框\n参数数量:2\n参数介绍:标题+显示内容", + "warning": "显示警告对话框\n参数数量:2\n参数介绍:标题+显示内容", + "exit": "退出程序\n参数数量:0\n参数介绍:无", + "bat": "执行 cmd 命令在 Wine 容器内(在 Windows 将在系统执行命令)\n参数数量:≥1\n参数介绍:接要执行的命令", + "bash": "执行 bash 命令(在 Windows 系统将执行 cmd 命令)\n参数数量:≥1\n参数介绍:接要执行的命令", + "version": "显示解释器版本(Wine 运行器版本)\n参数数量:0\n参数介绍:无", + "thank": "显示谢明列表\n参数数量:0\n参数介绍:无", + "pause": "按回车键后继续\n参数数量:0\n参数介绍:无", + "download": "使用 aria2 下载文件\n参数数量:≥1 && ≤3\n参数介绍:下载URL+保存在的文件夹+保存的文件名", + "installdxvk": "安装 dxvk 到指定容器\n参数数量:0\n参数介绍:无", + "createbotton": "在指定目录创建容器\n参数数量:0\n参数介绍:无", + "reg": "导入 .reg 文件\n参数数量:0\n参数介绍:reg 文件路径", + "enabledopengl": "开启 OpenGL\n参数数量:0\n参数介绍:无", + "disbledopengl": "关闭 OpenGL\n参数数量:0\n参数介绍:无", + "winecfg": "显示“Wine 设置”\n参数数量:0\n参数介绍:无", + "winver": "显示“关于 Wine”\n参数数量:0\n参数介绍:无", + "changeversion": "更改 Wine 容器系统版本(未实现)\n参数数量:无\n参数介绍:无", + "cat": "显示指定文件(只支持显示编码为UTF-8的文件)\n参数数量:1\n参数介绍:无", + "enabledhttpproxy": "设置指定容器代理\n参数数量:2\n参数介绍:代理服务器地址+端口", + "disbledhttpproxy": "禁用指定容器代理\n参数数量:0\n参数介绍:无", + "enabledwinecrashdialog": "启用 Wine 容器程序崩溃提示窗口\n参数数量:0\n参数介绍:无", + "disbledwinecrashdialog": "禁用 Wine 容器程序崩溃提示窗口\n参数数量:0\n参数介绍:无", + "disbledWinebottlecreatelink": "禁止 Wine 容器生成快捷方式\n参数数量:0\n参数介绍:无", + "enabledWinebottlecreatelink": "允许 Wine 容器生成快捷方式\n参数数量:0\n参数介绍:无", + "killall": "杀死指定进程\n参数数量:1\n参数介绍:进程名", + "control": "打开控制面板\n参数数量:0\n参数介绍:无", + "taskmgr": "打开任务管理器\n参数数量:0\n参数介绍:无", + "killallwineserver": "杀死所有 Wine 程序\n参数数量:0\n参数介绍:无", + "installvb": "安装指定的 VB 运行库到指定容器\n参数数量:1\n参数介绍:在安装 Visual Basic Runtime 工具的编号,如 4 Visual Basic Runtime Visual Basic 6", + "installother": "安装未归类的运行库到指定容器\n参数数量:1\n参数介绍:在安装其它运行库工具的编号,如 2 MFC运行库", + "decompressionbottle": "解压用 wine 打包的 deb 包内的容器到指定路径\n参数数量:2\n参数介绍:deb 包路径+要解压到的路径", + "programforum": "打开程序论坛\n参数数量:0\n参数介绍:无", + "installmsi": "安装 MSI 文件到指定容器\n参数数量:1\n参数介绍:msi 文件路径" +} \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ConfigLanguareRunner.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ConfigLanguareRunner.py new file mode 100755 index 0000000..240e2f4 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ConfigLanguareRunner.py @@ -0,0 +1,673 @@ +#!/usr/bin/env python3 +# 使用系统默认的 python3 运行 +########################################################################################### +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 版本:3.0.1 +# 更新时间:2022年10月05日 +# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 +# 基于 Python3 构建 +########################################################################################### +import os +import sys +import time +import json +import random +import api as uengineapi +import platform +import traceback +import webbrowser +import subprocess +import PyQt5.QtWidgets as QtWidgets +# 读取文本文档 +def readtxt(path): + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +information = json.loads(readtxt(f"{programPath}/information.json")) +version = information["Version"] +thankText = "" +helpList = json.loads(readtxt(f"{programPath}/ConfigLanguareRunner-help.json")) +for i in information["Contribute"]: + thankText += f"{i}\n" +programEnv = [ + ["($WINEPREFIX)", f"{os.path.expanduser('~')}/.wine"], + ["($WINE)", "deepin-wine6-stable"], + #["($DANGER)", "0"], + ["($DANGER)", "1"], + ["($HOME)", os.path.expanduser('~')], + ["($PROGRAMPATH)", programPath], + ["($VERSION)", version], + ["($THANK)", thankText], + ["($MAKER)", "RacoonGX 团队,By gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["($COPYRIGHT)", f"©2020~{time.strftime('%Y')} RacoonGX 团队,By gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["($?)", "0"], + ["($PLATFORM)", platform.system()], + ["($DEBUG)", "1"] + #["($DEBUG)", str(int("--debug" in sys.argv))] +] +readOnlyEnv = [ + "($DANGER)", + "($HOME)", + "($PROGRAMPATH)", + "($VERSION)", + "($THANK)", + "($MAKER)", + "($COPYRIGHT)", + "($?)", + "($SYSTEM)", + "($DEBUG)" +] + +def FindFile(file, name): + for i in os.listdir(file): + path = f"{file}/{i}" + if os.path.isdir(path): + returnPath = FindFile(path, name) + if returnPath != None: + return returnPath.replace("//", "/") + if os.path.isfile(path): + if i == name: + return path + return None + +def Debug(): + if "--debug" in sys.argv: + traceback.print_exc() + +class Command(): + # 有风险的命令 + dangerCommand = [ + "bash", + "bat", + "download", + "reg" + ] + # 可以被使用的命令 + commandList = [ + "installdll", + "installfont", + "installsparkcorefont", + "installmono", + "installgecko", + "installvcpp", + "installnet", + "installmsxml", + "echo", + "info", + "error", + "warning", + "exit", + "bash", + "bat", + "version", + "thank", + "pause", + "download", + "installdxvk", + "createbotton", + "reg", + "enabledopengl", + "disbledopengl", + "winecfg", + "winver", + "changeversion", + "stopdll", + "cat", + "taskmgr", + "control", + "killall", + "killallwineserver", + "enabledhttpproxy", + "disbledhttpproxy", + "enabledwinecrashdialog", + "disbledwinecrashdialog", + "disbledWinebottlecreatelink", + "enabledWinebottlecreatelink", + "installvb", + "installother", + "decompressionbottle", + "programforum", + "installmsi", + "installapk" + ] + + def __init__(self, commandString: str) -> None: + self.commandString = commandString + + # 解析器 + # 命令字符串转可供解析的列表 + def GetCommandList(self) -> list: + shellList = [] + shellFirstShell = self.commandString.split("\n") + # 转换成可以执行的数组 + for l in range(0, len(shellFirstShell)): + i = shellFirstShell[l] + # 判断有没有注释 + if "#" in i: + # 忽略注释 + i = i[:i.index("#")] + # 删除前后空格 + i = i.strip() + # 如果是空行 + if i == "": + # 忽略此行,此行不做处理 + continue + # 空格转义 + i = i.replace("\\ ", "@Space@") + # 解析 + i = i.split() + # 判断是否为合法的参数,否则提示并忽略 + if not i[0] in self.commandList and i[0][0] != "(": + print(f"行{l + 1}命令{i[0]}不存在,忽略") + programEnv[9][1] = "-2" + continue + if programEnv[2][1] == "0" and i[0] in self.dangerCommand: + print(f"行{l + 1}命令{i[0]}目前解析器不允许运行,忽略") + print("如果需要运行,可以在配置面板开启“允许修改系统”选项(针对GUI用户)") + print("或添加参数 --system(终端调用运行用户)") + programEnv[9][1] = "-1" + continue + rightList = [] + for k in i: + # 处理符号转义 + rightList.append(k.replace("@Space@", " ").replace("\\n", "\n").replace("\\r", "\r")) + shellList.append(rightList) + return shellList + + # 运行器 + class Run(): + close = False + programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string + def Exit(self): + self.close = True + return 0 + + def InstallDll(self) -> int: + import InstallDll + # 如果是数字 + number = False + try: + int(self.command[1]) + number = True + except: + pass + if number: + return InstallDll.Download(self.wineBottonPath, InstallDll.GetNameByNumber(int(self.command[1])), InstallDll.GetUrlByNumber(int(self.command[1])), self.wine) + return InstallDll.Download(self.wineBottonPath, self.command[1], InstallDll.GetUrlByName(self.command[1]), self.wine) + + def InstallDxvk(self): + if not os.path.exists(f"{programPath}/dxvk"): + if os.system(f"7z x \"{programPath}/dxvk.7z\" -o\"{programPath}\""): + print("错误:无法解压资源") + return 1 + os.remove(f"{programPath}/dxvk.7z") + return os.system(f"env 'WINE={self.wine}' 'WINE64={self.wine}' 'WINEPREFIX={self.wineBottonPath}' bash '{programPath}/dxvk/auto.sh' install") + + def Thank(self) -> int: + for i in information["Contribute"]: + print(i) + return 0 + + def InstallFont(self) -> int: + import InstallFont + return InstallFont.Download(self.wineBottonPath, int(self.command[1])) + + def InstallMono(self) -> int: + return os.system(f"ENTERNOTSHOW=0 '{self.programPath}/InstallMono.py' '{self.wineBottonPath}' '{self.wine}' mono") + + def InstallGecko(self) -> int: + return os.system(f"ENTERNOTSHOW=0 '{self.programPath}/InstallMono.py' '{self.wineBottonPath}' '{self.wine}' gecko") + + def InstallVCPP(self) -> int: + import InstallVisualCPlusPlus + return InstallVisualCPlusPlus.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def InstallNet(self) -> int: + import InstallNetFramework + return InstallNetFramework.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def InstallMsxml(self) -> int: + import InstallMsxml + return InstallMsxml.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def Info(self) -> int: + QtWidgets.QMessageBox.information(None, self.command[1], self.command[2]) + return 0 + + def StopDll(self) -> int: + return os.system(f"WINEPREFIX='{self.wineBottonPath}' '{self.wine}' reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(self.command[1])[0]} /f") + + def CreateBotton(self): + self.command = ["bat", "exit"] + self.Bat() + return 0 + + def InstallSparkCoreFont(self): + if not os.system("which aptss"): + # 最新版本星火应用商店处理 + os.system("pkexec bash aptss ssupdate") + return os.system("pkexec bash aptss install ms-core-fonts") + if not os.system("which ss-apt-fast"): + # 稍久的版本 + os.system("pkexec ss-apt-fast update") + return os.system("pkexec bash ss-apt-fast install ms-core-fonts") + # 不知道什么版本的处理方法 + if not os.system("which apt-fast"): + # 稍久的版本 + os.system("pkexec apt-fast update") + return os.system("pkexec apt-fast install ms-core-fonts") + os.system("pkexec apt update") + return os.system("pkexec apt install ms-core-fonts") + + def Echo(self) -> int: + del self.command[0] + print(" ".join(self.command)) + return 0 + + def Warning(self): + QtWidgets.QMessageBox.warning(None, self.command[1], self.command[2]) + return 0 + + def Error(self): + QtWidgets.QMessageBox.critical(None, self.command[1], self.command[2]) + return 0 + + def Bash(self): + command = "" + for i in self.command[1:]: + command += f"'{i}' " + return os.system(command) + + def Bat(self) -> int: + # Windows 直接转换为以 cmd 运行 + if platform.system() == "Windows": + # 直接调用 Bash 函数 + return self.Bash() + command = ["WINEPREFIX='($WINEPREFIX)'", "($WINE)"] + for i in programEnv: + for k in range(len(command)): + command[k] = command[k].replace(i[0], i[1]) + for i in self.command[1:]: + command.append(i) + commandStr = command[0] + " " + for i in command[1:]: + commandStr += f"'{i}' " + return os.system(commandStr) + + def Version(self): + print(f"版本:{version}") + print(f"©2020~{time.strftime('%Y')} RacoonGX 团队,By gfdgd xi、为什么您不喜欢熊出没和阿布呢") + return 0 + + def Pause(self) -> int: + input("按回车键继续……") + return 0 + + def Download(self) -> int: + command = f"aria2c -x 16 -s 16 -c '{self.command[1]}' " + try: + command += f"-d '{self.command[2]}' " + command += f"-o '{self.command[3]}' " + except: + pass + return os.system(command) + + def Reg(self) -> int: + self.command = ["bat", "regedit", "/s", self.command[1]] + return self.Bat() + + def EnabledOpenGl(self) -> int: + self.command = ["reg", f"z:{programPath}/EnabledOpengl.reg"] + return self.Reg() + + def DisbledOpenGl(self) -> int: + self.command = ["reg", f"z:{programPath}/DisabledOpengl.reg"] + return self.Reg() + + def Winver(self): + self.command = ["bat", "winver"] + return self.Bat() + + def Winecfg(self): + self.command = ["bat", "winecfg"] + return self.Bat() + + def ChangeVersion(self): + # 判断是否为正确的版本 + if not os.path.exists(f"{programPath}/ChangeWineBottonVersion/{self.command[1]}.reg"): + print("错误:您选择的版本错误,目前只支持以下版本") + for i in os.listdir(f"{programPath}/ChangeWineBottonVersion"): + print(i.replace(".reg", ""), end=" ") + print() + return 1 + self.command = ["reg", f"z:/{programPath}/ChangeWineBottonVersion/{self.command[1]}.reg"] + return self.Reg() + + def Cat(self): + try: + file = open(self.command[1], "r") + print(file.read()) + file.close() + return 0 + except: + print("文件读取错误") + Debug() + return 1 + + def Taskmgr(self): + self.command = ["bat", "taskmgr"] + return self.Bat() + + def Control(self): + self.command = ["bat", "control"] + return self.Bat() + + def Killall(self): + return os.system(f"killall -9 {self.command[1]}") + + def KillallWineServer(self): + command = ["WINEPREFIX='($WINEPREFIX)'", "($WINE)", "-k"] + for i in programEnv: + for k in range(len(command)): + command[k] = command[k].replace(i[0], i[1]) + if "box86" in command[1] or "exagear" in command[1] or "box64" in command[1]: + print("不支持此 Wine") + return 1 + if os.path.exists(command[1]): + # 文件存在 + command[1] = f"{os.path.dirname(command[1])}/wineserver" + else: + # 读 which + command[1] = f"{os.path.dirname(subprocess.getoutput(f'which {command[1]}').strip())}/wineserver" + commandStr = command[0] + " " + for i in command[1:]: + commandStr += f"'{i}' " + return os.system(commandStr) + + def EnabledWineBottleCreateLink(self): + self.command = ["bat", "reg", "delete", "HKEY_CURRENT_USER\Software\Wine\DllOverrides", "/v", "winemenubuilder.exe", "/f"] + return self.Bat() + + def DisbledWineBottleCreateLink(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\DllOverrides", "/v", "winemenubuilder.exe", "/f"] + return self.Bat() + + def DisbledWineCrashDialog(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\WineDbg", "/v", "ShowCrashDialog", "/t", "REG_DWORD", "/d", "00000000", "/f"] + return self.Bat() + + def EnabledWineCrashDialog(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Wine\WineDbg", "/v", "ShowCrashDialog", "/t", "REG_DWORD", "/d", "00000001", "/f"] + return self.Bat() + + def EnabledHttpProxy(self): + proxyServerAddress = self.command[1] + port = self.command[2] + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyEnable", "/t", "REG_DWORD", "/d", "00000001", "/f"] + self.Bat() + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyServer", "/d", f"{proxyServerAddress}:{port}", "/f"] + return self.Bat() + + def DecompressionBottle(self): + tempDebDir = f"/tmp/wine-runner-unpack-deb-{random.randint(0, 1000)}" + if os.system(f"dpkg -x '{self.command[1]}' '{tempDebDir}'"): + return 1 + zippath = FindFile(tempDebDir, "files.7z") + if zippath == None: + return 2 + # 解压文件 + os.system(f"mkdir -p '{self.command[2]}'") + fi = os.system(f"7z x -y '{zippath}' -o'{self.command[2]}'") + os.system(f"rm -rfv '{tempDebDir}'") + return fi + + + def DisbledHttpProxy(self): + self.command = ["bat", "reg", "add", "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "/v", "ProxyEnable", "/t", "REG_DWORD", "/d", "00000000", "/f"] + return self.Bat() + + def InstallVB(self): + import InstallVisualBasicRuntime + return InstallVisualBasicRuntime.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def InstallOther(self): + import InstallOther + return InstallOther.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def ProgramForum(self): + webbrowser.open_new_tab("https://gfdgdxi.flarum.cloud/") + return + + def InstallMSI(self): + self.command = ["bat", "msiexec", "/i", self.command[1]] + return self.Bat() + + def InstallApk(self): + if os.system("which uengine > /dev/null"): + print("未安装 UEngine,无法使用该命令") + return 1 + apk = uengineapi.APK(self.command[1]) + result = apk.install() + homePath = os.getenv("HOME") + if not os.path.exists(f"{homePath}/.local/share/applications/uengine"): + os.makedirs(f"{homePath}/.local/share/applications/uengine") + if not os.path.exists(f"{homePath}/.local/share/icons/hicolor/apps"): + os.makedirs(f"{homePath}/.local/share/icons/hicolor/apps") + package = apk.packageName() + apk.saveApkIcon(f"{homePath}/.local/share/icons/hicolor/apps/{package}.png") + apk.saveDesktopFile(f"{homePath}/.local/share/applications/uengine/{package}.desktop", f"{homePath}/.local/share/icons/hicolor/apps/{package}.png") + return result + + # 可以运行的命令的映射关系 + # 可以被使用的命令的映射 + commandList = { + "installdll": InstallDll, + "installfont": InstallFont, + "installsparkcorefont": InstallSparkCoreFont, + "installmono": InstallMono, + "installgecko": InstallGecko, + "installvcpp": InstallVCPP, + "installnet": InstallNet, + "installmsxml": InstallMsxml, + "echo": Echo, + "info": Info, + "warning": Warning, + "error": Error, + "exit": Exit, + "bash": Bash, + "bat": Bat, + "version": Version, + "thank": Thank, + "pause": Pause, + "download": Download, + "installdxvk": InstallDxvk, + "createbotton": CreateBotton, + "reg": Reg, + "enabledopengl": EnabledOpenGl, + "disbledopengl": DisbledOpenGl, + "winecfg": Winecfg, + "winver": Winver, + "changeversion": ChangeVersion, + "stopdll": StopDll, + "cat": Cat, + "taskmgr": Taskmgr, + "control": Control, + "killallwineserver": KillallWineServer, + "enabledhttpproxy": EnabledHttpProxy, + "disbledhttpproxy": DisbledHttpProxy, + "enabledwinecrashdialog": EnabledWineCrashDialog, + "disbledwinecrashdialog": DisbledWineCrashDialog, + "disbledWinebottlecreatelink": DisbledWineBottleCreateLink, + "enabledWinebottlecreatelink": EnabledWineBottleCreateLink, + "installvb": InstallVB, + "installother": InstallOther, + "decompressionbottle": DecompressionBottle, + "programforum": ProgramForum, + "installmsi": InstallMSI, + "installapk": InstallApk + } + + # 参数数列表 + commandInfo = { + "killall": [1], + "installdll": [1], + "installfont": [1], + "installsparkcorefont": [0], + "installmono": [0], + "installgecko": [0], + "installvcpp": [1], + "installnet": [1], + "installmsxml": [1], + "echo": [1], + "info": [2], + "warning": [2], + "error": [2], + "exit": [0], + "bash": [1], + "bat": [1], + "version": [0], + "thank": [0], + "pause": [0], + "download": [1], + "installdxvk": [0], + "createbotton": [0], + "reg": [1], + "enabledopengl": [0], + "disbledopengl": [0], + "winecfg": [0], + "winver": [0], + "changeversion": [1], + "stopdll": [1], + "cat": [1], + "taskmgr": [0], + "control": [0], + "killallwineserver": [0], + "enabledhttpproxy": [2], + "disbledhttpproxy": [0], + "enabledwinecrashdialog": [0], + "disbledwinecrashdialog": [0], + "disbledWinebottlecreatelink": [0], + "enabledWinebottlecreatelink": [0], + "installvb": [1], + "installother": [1], + "decompressionbottle": [2], + "programforum": [0], + "installmsi": [1], + "installapk": [1] + } + windowsUnrun = [ + "createbotton", + "installdll", + "installmono", + "installgecko", + "winecfg", + "stopdll", + "changeversion", + "enabledopengl", + "disbledopengl", + "installdxvk", + "installfont", + "installsparkcorefont", + "decompressionbottle", + "installapk" + ] + # 解析 + def __init__(self, command: list, wineBottonPath: str, wine: str) -> int: + self.wineBottonPath = wineBottonPath + self.wine = wine + for i in command: + self.command = i + # 变量解析 + if self.command[0][0] == "(" and "=" in self.command[0]: + env = i[0][: i[0].index("=")] + value = i[0][i[0].index("=") + 1:] + # 判断是不是只读变量 + if env in readOnlyEnv: + print(f"运行命令{' '.join(self.command)}出现错误") + print(f"变量 {env} 只读,无法修改,忽略") + continue + change = False + for k in range(len(programEnv)): + # 修改变量 + if env == programEnv[k][0]: + programEnv[k][1] = value + change = True + break + if not change: + # 添加变量 + programEnv.append([f"{env}", value]) + continue + # 解析命令是否可以在 Windows 使用(只限在 Windows 系统时) + if platform.system() == "Windows" and i[0] in self.windowsUnrun: + print("此命令不支持在 Windows 上运行") + programEnv[9][1] = "-5" + continue + # 获取程序帮助信息 + try: + if i[1] == "--help": + print(helpList[i[0]].replace("\\n", "\n")) + continue + except: + pass + # 正常命令解析 + if len(i) -1 < self.commandInfo[i[0]][0]: + print("参数不足") + programEnv[9][1] = "-3" + continue + # 替换环境变量 + for a in range(1, len(i)): + for b in programEnv: + if b[0] in i[a]: + i[a] = i[a].replace(b[0], b[1]) + try: + commandReturn = self.commandList[i[0]](self) + except: + traceback.print_exc() + commandReturn = 1 + if commandReturn: + print(f"运行命令{' '.join(self.command)}出现错误,返回值:", commandReturn) + programEnv[9][1] = str(commandReturn) + if self.close: + break + +app = QtWidgets.QApplication(sys.argv) +if os.getenv("WINE") != None: + programEnv[1][1] = os.getenv("WINE") +if os.getenv("WINEPREFIX") != None: + programEnv[0][1] = os.getenv("WINEPREFIX") +if __name__ == "__main__": + optionAll = 0 + if "--debug" in sys.argv: + optionAll += 1 + if "--system" in sys.argv: + programEnv[2][1] = "1" + optionAll += 1 + if len(sys.argv) - optionAll < 2: + print("Wine 运行器自动配置文件解析器交互环境") + print(f"版本:{version}") + print(f"©2020~{time.strftime('%Y')} RacoonGX 团队,By gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("--------------------------------------------------------------") + while True: + commandLine = input(">") + if commandLine == "exit": + break + com = Command(commandLine) + com.Run(com.GetCommandList(), programEnv[0][1], programEnv[1][1]) + sys.exit(int(programEnv[9][1])) + # 读取文件 + try: + file = open(sys.argv[1], "r") + com = Command(file.read()) + file.close() + except: + print("错误:无法读取该文件,无法继续") + sys.exit(1) + print("Wine 运行器自动配置文件解析器") + print(f"版本:{version}") + print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("--------------------------------------------------------------") + com.Run(com.GetCommandList(), programEnv[0][1], programEnv[1][1]) + sys.exit(int(programEnv[9][1])) \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ProgramFen.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ProgramFen.py new file mode 100755 index 0000000..33d95b0 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/ProgramFen.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python3 +import os +import sys +import base64 +import traceback +import requests +import PyQt5.QtGui as QtGui +import PyQt5.QtCore as QtCore +import PyQt5.QtWidgets as QtWidgets + +class ProgramRunStatusShow(): + msgWindow = None + def ShowWindow(): + try: + fenlists = [] + for i in range(6): + fenlists.append(int(requests.get(base64.b64decode("aHR0cHM6Ly9jb2RlLmdpdGxpbmsub3JnLmNuL2dmZGdkLXhpLW9yZy93aW5lLXJ1bm5lci1kb3dubG9hZHMtb2YtcnVubmVyL3Jhdy9icmFuY2gvbWFzdGVyL0Zlbi1VRW5naW5lL0Zlbg==").decode("utf-8") + f"{i}.txt").text)) + tipsInfo = "" + except: + traceback.print_exc() + fenlists = [0, 0, 0, 0, 0] + tipsInfo = "暂时无人提交此脚本运行情况,是否立即提交?" + + maxHead = fenlists.index(max(fenlists)) + allNumber = 0 + for i in fenlists: + allNumber += i + try: + #tipsInfo = "" + for i in range(len(fenlists)): + # 显示整数 + tipsInfo += f"有 {int(fenlists[i] / allNumber * 100)}% 的用户选择了 {i} 分({fenlists[i]}/{allNumber})\n" + maxNumber = int(max(fenlists) / allNumber * 100) + #if tipsInfo == "": + # tipsInfo = f"有{maxNumber}%的用户选择了这个评分" + except: + pass + ProgramRunStatusShow.msgWindow = QtWidgets.QMainWindow() + msgWidget = QtWidgets.QWidget() + msgWidgetLayout = QtWidgets.QGridLayout() + starLayout = QtWidgets.QHBoxLayout() + uploadButton = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "点此上传运行情况")) + uploadButton.clicked.connect(ProgramRunStatusUpload.ShowWindow) + msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "综合评价:")), 0, 0) + msgWidgetLayout.addLayout(starLayout, 0, 1) + msgWidgetLayout.addWidget(QtWidgets.QLabel(tipsInfo), 1, 0, 1, 2) + msgWidgetLayout.addWidget(uploadButton, 3, 0, 1, 2) + end = 5 + if maxHead > 5: + for i in range(end): + starLayout.addWidget(QtWidgets.QLabel(f"")) + else: + for i in range(maxHead): + starLayout.addWidget(QtWidgets.QLabel(f"")) + head = maxHead + for i in range(head, end): + starLayout.addWidget(QtWidgets.QLabel(f"")) + msgWidget.setLayout(msgWidgetLayout) + ProgramRunStatusShow.msgWindow.setCentralWidget(msgWidget) + ProgramRunStatusShow.msgWindow.setWindowIcon(QtGui.QIcon(iconPath)) + ProgramRunStatusShow.msgWindow.setWindowTitle(f"程序运行情况") + ProgramRunStatusShow.msgWindow.show() + +class ProgramRunStatusUpload(): + msgWindow = None + starLayout = None + fen = None + starList = [] + sha1Value = "" + programName = None + def ChangeStar(): + if ProgramRunStatusUpload.fen.currentIndex() > 5: + for i in ProgramRunStatusUpload.starList: + i.setText(f"") + return + for i in range(ProgramRunStatusUpload.fen.currentIndex()): + ProgramRunStatusUpload.starList[i].setText(f"") + head = ProgramRunStatusUpload.fen.currentIndex() + end = len(ProgramRunStatusUpload.starList) + for i in range(head, end): + ProgramRunStatusUpload.starList[i].setText(f"") + + def ShowWindow(): + ProgramRunStatusUpload.starList = [] + ProgramRunStatusUpload.msgWindow = QtWidgets.QMainWindow(ProgramRunStatusShow.msgWindow) + msgWidget = QtWidgets.QWidget() + msgWidgetLayout = QtWidgets.QGridLayout() + ProgramRunStatusUpload.fen = QtWidgets.QComboBox() + ProgramRunStatusUpload.starLayout = QtWidgets.QHBoxLayout() + upload = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "上传")) + upload.clicked.connect(ProgramRunStatusUpload.Upload) + # 生成星星列表 + for i in [1, 1, 1, 1, 1]: + ProgramRunStatusUpload.starList.append(QtWidgets.QLabel(f"")) + ProgramRunStatusUpload.starLayout.addWidget(ProgramRunStatusUpload.starList[-1]) + ProgramRunStatusUpload.starLayout.addItem(QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) + ProgramRunStatusUpload.fen.addItems(["0分", "1分", "2分", "3分", "4分", "5分"]) + ProgramRunStatusUpload.fen.setCurrentIndex(5) + ProgramRunStatusUpload.fen.currentIndexChanged.connect(ProgramRunStatusUpload.ChangeStar) + msgWidgetLayout.addWidget(QtWidgets.QLabel(QtCore.QCoreApplication.translate("U", "评分:")), 1, 0) + msgWidgetLayout.addWidget(ProgramRunStatusUpload.fen, 1, 1) + msgWidgetLayout.addLayout(ProgramRunStatusUpload.starLayout, 2, 1) + msgWidgetLayout.addWidget(upload, 3, 1) + msgWidget.setLayout(msgWidgetLayout) + ProgramRunStatusUpload.msgWindow.setCentralWidget(msgWidget) + ProgramRunStatusUpload.msgWindow.setWindowTitle(QtCore.QCoreApplication.translate("U", "上传程序运行情况")) + ProgramRunStatusUpload.msgWindow.setWindowIcon(QtGui.QIcon(iconPath)) + ProgramRunStatusUpload.msgWindow.show() + + def Upload(): + try: + QtWidgets.QMessageBox.information(ProgramRunStatusUpload.msgWindow, QtCore.QCoreApplication.translate("U", "提示"), requests.get(f"http://120.25.153.144/spark-deepin-wine-runner/Install.php?Version=Fen{ProgramRunStatusUpload.fen.currentIndex()}-UEngine").json()["Error"]) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(ProgramRunStatusUpload.msgWindow, QtCore.QCoreApplication.translate("U", "错误"), QtCore.QCoreApplication.translate("U", "数据上传失败!")) + +if __name__ == "__main__": + programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string + iconPath = "{}/deepin-wine-runner.svg".format(programPath) + app = QtWidgets.QApplication(sys.argv) + ProgramRunStatusShow.ShowWindow() + app.exec_() diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UI/AutoConfig.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UI/AutoConfig.py new file mode 100755 index 0000000..657eece --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UI/AutoConfig.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'AutoConfig.ui' +# +# Created by: PyQt5 UI code generator 5.11.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt5 import QtCore, QtGui, QtWidgets + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(800, 600) + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.centralwidget) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.searchTips = QtWidgets.QLabel(self.centralwidget) + self.searchTips.setObjectName("searchTips") + self.horizontalLayout.addWidget(self.searchTips) + self.searchThings = QtWidgets.QLineEdit(self.centralwidget) + self.searchThings.setObjectName("searchThings") + self.horizontalLayout.addWidget(self.searchThings) + self.saerchBotton = QtWidgets.QPushButton(self.centralwidget) + self.saerchBotton.setObjectName("saerchBotton") + self.horizontalLayout.addWidget(self.saerchBotton) + self.verticalLayout_3.addLayout(self.horizontalLayout) + self.searchList = QtWidgets.QListView(self.centralwidget) + self.searchList.setObjectName("searchList") + self.verticalLayout_3.addWidget(self.searchList) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.getInfoButton = QtWidgets.QPushButton(self.centralwidget) + self.getInfoButton.setObjectName("getInfoButton") + self.horizontalLayout_2.addWidget(self.getInfoButton) + self.getFen = QtWidgets.QPushButton(self.centralwidget) + self.getFen.setObjectName("getFen") + self.horizontalLayout_2.addWidget(self.getFen) + self.runBotton = QtWidgets.QPushButton(self.centralwidget) + self.runBotton.setObjectName("runBotton") + self.horizontalLayout_2.addWidget(self.runBotton) + self.verticalLayout_3.addLayout(self.horizontalLayout_2) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 36)) + self.menubar.setObjectName("menubar") + self.menu = QtWidgets.QMenu(self.menubar) + self.menu.setObjectName("menu") + self.menu_2 = QtWidgets.QMenu(self.menubar) + self.menu_2.setObjectName("menu_2") + MainWindow.setMenuBar(self.menubar) + self.about = QtWidgets.QAction(MainWindow) + self.about.setObjectName("about") + self.exitProgram = QtWidgets.QAction(MainWindow) + self.exitProgram.setObjectName("exitProgram") + self.help = QtWidgets.QAction(MainWindow) + self.help.setObjectName("help") + self.openFile = QtWidgets.QAction(MainWindow) + self.openFile.setObjectName("openFile") + self.actionGitlink = QtWidgets.QAction(MainWindow) + self.actionGitlink.setCheckable(True) + self.actionGitlink.setChecked(True) + self.actionGitlink.setObjectName("actionGitlink") + self.actionGitee = QtWidgets.QAction(MainWindow) + self.actionGitee.setCheckable(True) + self.actionGitee.setObjectName("actionGitee") + self.actionGithub = QtWidgets.QAction(MainWindow) + self.actionGithub.setCheckable(True) + self.actionGithub.setObjectName("actionGithub") + self.action_IPv6 = QtWidgets.QAction(MainWindow) + self.action_IPv6.setCheckable(True) + self.action_IPv6.setObjectName("action_IPv6") + self.action = QtWidgets.QAction(MainWindow) + self.action.setCheckable(True) + self.action.setObjectName("action") + self.action_2 = QtWidgets.QAction(MainWindow) + self.action_2.setCheckable(True) + self.action_2.setChecked(False) + self.action_2.setObjectName("action_2") + self.action_3 = QtWidgets.QAction(MainWindow) + self.action_3.setCheckable(True) + self.action_3.setObjectName("action_3") + self.menu.addAction(self.openFile) + self.menu.addSeparator() + self.menu.addAction(self.exitProgram) + self.menu_2.addAction(self.actionGitlink) + self.menu_2.addAction(self.actionGitee) + self.menu_2.addAction(self.actionGithub) + self.menu_2.addAction(self.action_IPv6) + self.menu_2.addAction(self.action_2) + self.menu_2.addAction(self.action_3) + self.menu_2.addAction(self.action) + self.menubar.addAction(self.menu.menuAction()) + self.menubar.addAction(self.menu_2.menuAction()) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "自动部署脚本")) + self.searchTips.setText(_translate("MainWindow", "搜索内容(为空代表显示所有内容):")) + self.saerchBotton.setText(_translate("MainWindow", "搜索")) + self.getInfoButton.setText(_translate("MainWindow", "获取选中项介绍")) + self.getFen.setText(_translate("MainWindow", "获取/提交选中项的评分和评论")) + self.runBotton.setText(_translate("MainWindow", "安装")) + self.menu.setTitle(_translate("MainWindow", "程序")) + self.menu_2.setTitle(_translate("MainWindow", "切换源")) + self.about.setText(_translate("MainWindow", "关于")) + self.exitProgram.setText(_translate("MainWindow", "退出程序")) + self.help.setText(_translate("MainWindow", "帮助")) + self.openFile.setText(_translate("MainWindow", "打开本地部署脚本")) + self.actionGitlink.setText(_translate("MainWindow", "Gitlink 源(推荐)")) + self.actionGitee.setText(_translate("MainWindow", "Gitee 源")) + self.actionGithub.setText(_translate("MainWindow", "Github 源(国外用户推荐)")) + self.action_IPv6.setText(_translate("MainWindow", "备用源1(只限IPv6用户)")) + self.action.setText(_translate("MainWindow", "本地测试源(127.0.0.1)")) + self.action_2.setText(_translate("MainWindow", "备用源2")) + self.action_3.setText(_translate("MainWindow", "备用源3")) + diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UI/AutoConfig.ui b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UI/AutoConfig.ui new file mode 100755 index 0000000..7642e3a --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/UI/AutoConfig.ui @@ -0,0 +1,199 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + 自动部署脚本 + + + + + + + + + 搜索内容(为空代表显示所有内容): + + + + + + + + + + 搜索 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 获取选中项介绍 + + + + + + + 获取/提交选中项的评分和评论 + + + + + + + 安装 + + + + + + + + + + + 0 + 0 + 800 + 36 + + + + + 程序 + + + + + + + + 切换源 + + + + + + + + + + + + + + + 关于 + + + + + 退出程序 + + + + + 帮助 + + + + + 打开本地部署脚本 + + + + + true + + + true + + + Gitlink 源(推荐) + + + + + true + + + Gitee 源 + + + + + true + + + Github 源(国外用户推荐) + + + + + true + + + 备用源1(只限IPv6用户) + + + + + true + + + 本地测试源(127.0.0.1) + + + + + true + + + false + + + 备用源2 + + + + + true + + + 备用源3 + + + + + + diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py index 9409c47..abd242c 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/api/__init__.py @@ -45,9 +45,9 @@ class APK: def __init__(self, apkPath): self.apkPath = apkPath def install(self): - os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(self.apkPath)) + return os.system("uengine install --apk='{}'".format(self.apkPath)) def uninstall(self): - os.system("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(self.packageName())) + return os.system("uengine uninstall --pkg='{}'".format(self.packageName())) def information(self): return subprocess.getoutput("aapt dump badging '{}'".format(self.apkPath)) def activityName(self): @@ -362,10 +362,11 @@ class UengineRunner: if __name__ == "__main__": print("本 API 不支持直接运行,请通过引入的方式使用此 API") - adb = Adb("192.168.250.2:5555") - print(adb.boolAndroidInstallOtherAppSetting()) + #adb = Adb("192.168.250.2:5555") + #print(adb.boolAndroidInstallOtherAppSetting()) quit() if not ROOT.GetRoot(): - print("请获取 ROOT 权限以便更好的使用该 API") \ No newline at end of file + pass + #print("请获取 ROOT 权限以便更好的使用该 API") \ No newline at end of file diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json index a224338..a287b4a 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/information.json @@ -5,7 +5,7 @@ "https://github.com/gfdgd-xi/uengine-runner", "https://gitlink.org.cn/gfdgd_xi/uengine-runner" ], - "Version": "1.8.3", + "Version": "2.0.0", "System": "Linux(deepin/UOS)", "Tips": [ "更多可见:https://gitee.com/gfdgd-xi/uengine-runner/wikis 或程序的更多帮助", @@ -23,6 +23,16 @@ "5、如果想要使用adb连接UEngine或其他手机,请使用 1.2.0 以前的版本。(如需连接UEngine请安装adb补丁)" ], "Update": [ + "V2.0.0:", + "※1、内置微型应用商店,支持评论、评分功能;", + "※2、修复 UEngine 安装器在 Wayland 下无法正常运行的问题;", + "※3、更新 UEngine 安装器安装的 UEngine 版本;", + "※4、修复 UEngine 安装器安装后的 UEngine 无法正常安装 APK 的问题(包括从运行器和 deb 包安装);", + "※5、UEngine 安装器安装后的 UEngine 支持开机后自动加载运行环境,无需人手动打开终端运行;", + "6、更改程序论坛网址;", + "7、新增程序评分功能;", + "8、……", + "", "V1.8.3:", "※1、修复安装/打包程序时出现找不到图标的问题;", "※2、修复部分无法正确获取程序中文名和 Activity 的问题;", @@ -205,7 +215,7 @@ "11、deepin 终端", "……" ], - "Time": "2022年12月18日", + "Time": "2023年01月13日", "Contribute": [ "感谢以下用户提供的问题、建议、图标、代码等,如果有遗漏,请及时与开发者联系添加,以及如果侵犯到您的合法权益,也及时与开发者联系:

", "
", diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/run-program-without-wayland.sh b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/run-program-without-wayland.sh new file mode 100644 index 0000000..2ffe898 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/run-program-without-wayland.sh @@ -0,0 +1,4 @@ +#!/bin/bash +export XDG_SESSION_TYPE=x11 +export QT_QPA_PLATFORM=xcb +unset WAYLAND_DISPLAYCOPY diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder index ee1b48e..a9c4d9f 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-apk-builder @@ -18,6 +18,7 @@ import random import zipfile import traceback import subprocess +import updatekiller import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets @@ -484,10 +485,10 @@ widget.setLayout(widgetLayout) window.setWindowTitle(title) window.setCentralWidget(widget) window.setWindowIcon(QtGui.QIcon(iconPath)) -window.resize(window.frameSize().width() * 1.3, window.frameSize().height() * 1.1) +window.resize(int(window.frameSize().width() * 1.3), int(window.frameSize().height() * 1.1)) try: combobox1.setCurrentText(sys.argv[1]) except: print("无参数") window.show() -sys.exit(app.exec_()) \ No newline at end of file +sys.exit(app.exec_()) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install index 120467c..5984cb2 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-install @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os import sys +import updatekiller if len(sys.argv) > 1: if sys.argv[1] == "--help": print("帮助:") @@ -8,4 +9,4 @@ if len(sys.argv) > 1: sys.exit(0) sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(sys.argv[1]))) print("命令参数错误") -sys.exit(1) \ No newline at end of file +sys.exit(1) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-setting.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-setting.py index 2fca036..0993ca1 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-setting.py +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-setting.py @@ -2,6 +2,7 @@ from modulefinder import packagePathMap import sys import ttkthemes +import updatekiller import tkinter as tk import tkinter.ttk as ttk @@ -31,4 +32,4 @@ def main(): return 0 if __name__ == "__main__": - sys.exit(main()) \ No newline at end of file + sys.exit(main()) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall index 452bfc9..6e63022 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-app-uninstall @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os import sys +import updatekiller if len(sys.argv) > 1: if sys.argv[1] == "--help": print("帮助:") @@ -8,4 +9,4 @@ if len(sys.argv) > 1: sys.exit(0) sys.exit(os.system("sudo /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(sys.argv[1]))) print("命令参数错误") -sys.exit(1) \ No newline at end of file +sys.exit(1) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean index 98543e0..8c3a509 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-clean @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os import sys +import updatekiller if len(sys.argv) > 1: if sys.argv[1] == "--help": print("帮助:") @@ -8,4 +9,4 @@ if len(sys.argv) > 1: sys.exit(0) print("参数错误") sys.exit(1) -sys.exit(os.system("sudo rm -rf /data/uengine")) \ No newline at end of file +sys.exit(os.system("sudo rm -rf /data/uengine")) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer index 8a0a44b..4b68c3b 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-installer @@ -1,39 +1,84 @@ #/bin/bash -is_tar_checked="0" +# 在 Shenmo 制作的脚本的基础上进行了修改,修复在 Wayland 下运行错误和无法安装程序的问题 +# 建议在 Ubuntu 22.04 及以上版本安装,最好在此之前先安装星火应用商店并将系统和星火应用商店更新到最新版本 +#is_tar_checked="0" rm -rf /tmp/uengine -until [ "$is_tar_checked" = "1" ];do +# 不再从网盘下载,直接从 Gitlink 拉取安装包 +#until [ "$is_tar_checked" = "1" ];do #echo "请拖入uengine.tar.xz并回车确认,可在 https://cowtransfer.com/s/44656ada129e42 下载获取。" #read tar_path mkdir -p /tmp/uengine -aria2c -x 16 -s 16 -d /tmp/uengine -o uenginetar.xz https://code.gitlink.org.cn/gfdgd_xi/uengine-installer/raw/branch/master/uenginetar.xz +# 区分是下载 Root 镜像还是普通镜像 +if[[ $1 == "SuperSU" ]]; then + aria2c -x 16 -s 16 -d /tmp/uengine -o uenginetar.xz https://code.gitlink.org.cn/gfdgd_xi/uengine-installer/raw/branch/master/uengine2.1.2.2007-supersu.tar.xz +else + aria2c -x 16 -s 16 -d /tmp/uengine -o uenginetar.xz https://code.gitlink.org.cn/gfdgd_xi/uengine-installer/raw/branch/master/uengine2.1.2.2007.tar.xz +fi tar_path="/tmp/uengine/uenginetar.xz" tar_path=`echo "$tar_path" | sed $'s/\'//g'` +# 忽略md5校验 #echo "路径为 $tar_path" -tar_md5sum=`md5sum $tar_path` -tar_md5sum=`echo ${tar_md5sum%%/*}` +#tar_md5sum=`md5sum $tar_path` +#tar_md5sum=`echo ${tar_md5sum%%/*}` +# 忽略 md5 校验 +#if [ "$tar_md5sum" = "5668b6bb54d28406e527989348126982" ];then +#is_tar_checked="1" +#else +#echo $tar_md5sum +#echo "md5完整性检查失败,请检查是否是这个文件" +#sleep 3 +#reset +#fi +#done -if [ "$tar_md5sum" = "5668b6bb54d28406e527989348126982" ];then -is_tar_checked="1" -else -echo $tar_md5sum -echo "md5完整性检查失败,请检查是否是这个文件" -sleep 3 -reset -fi -done - -echo "完整性检查通过,开始部署。部署过程会需要root权限,完成后会要求重启。请注意不要在安装过程中安装或卸载其他软件" +#echo "完整性检查通过,开始部署。部署过程会需要root权限,完成后会要求重启。请注意不要在安装过程中安装或卸载其他软件" +echo "开始部署。部署过程会需要root权限,完成后会要求重启。请注意不要在安装过程中安装或卸载其他软件" cd /tmp tar -xf "$tar_path" -mkdir -p $HOME/uengine -mkdir -p $HOME/uengine-launch -cp /tmp/uengine/run_daemon.sh $HOME/uengine-launch -cp /tmp/uengine/launch_uengine.sh $HOME/uengine-launch +# 移除包内旧版的run_daemon.sh(如果有的话) +aria2c -x 16 -s 16 -d /tmp -o run_daemon.sh https://code.gitlink.org.cn/gfdgd_xi/uengine-installer-bak/raw/branch/master/run_daemon.sh +if [[ $? == 0 ]]; then + # 如果下载成功,就使用下载好的 run_daemon.sh + if [[ -f /tmp/run_daemon.sh ]]; then + rm -rfv /tmp/uengine/run_daemon.sh + mv -v /tmp/run_daemon.sh /tmp/uengine/run_daemon.sh + fi +fi +# 拷贝到每个用户目录 +for username in $(ls /home) + do + echo /home/$username + sudo mkdir -p /home/$username/uengine + sudo mkdir -p /home/$username/uengine-launch + sudo cp /tmp/uengine/run_daemon.sh /home/$username/uengine-launch + # 赋予可执行权限 + sudo chmod +x /home/$username/uengine-launch/run_daemon.sh + #cp /tmp/uengine/launch_uengine.sh $username/uengine-launch + done +# 单独拷贝一份到 /usr/bin 下以做到每次开机自动化调用 +sudo cp /tmp/uengine/run_daemon.sh /usr/bin/uengine-loading-ubuntu +sudo chmod 755 /usr/bin/uengine-loading-ubuntu +#mkdir -p $HOME/uengine +#mkdir -p $HOME/uengine-launch +#cp /tmp/uengine/run_daemon.sh $HOME/uengine-launch +#cp /tmp/uengine/launch_uengine.sh $HOME/uengine-launch cd /tmp/uengine /tmp/uengine/install.sh -sudo apt install -y libkf5globalaccel5 libqt5multimedia5 libqt5sensors5 libegl1-mesa-dev -echo "重启后在$HOME/uengine-launch执行launch_uengine.sh即可打开uengine守护进程。随后即可安装和使用安卓应用" +# 安装所需依赖 +sudo apt install -y libkf5globalaccel5 libqt5multimedia5 libqt5sensors5 libegl1-mesa-dev +# 用于修复 UEngine 在 Ubuntu 无法安装 APK 的问题 +sudo mkdir -p /var/lib/uengine +sudo ln -s /data/uengine/data/data/ /var/lib/uengine/data +# 拷贝快捷方式 +cd `dirname $0` +sudo cp uengine-loading-ubuntu.desktop /usr/share/applications +sudo cp uengine-loading-ubuntu.desktop /etc/xdg/autostart +sudo chmod 755 /etc/xdg/autostart/uengine-loading-ubuntu.desktop +# echo "重启后在$HOME/uengine-launch执行launch_uengine.sh即可打开uengine守护进程。随后即可安装和使用安卓应用" +# 这里直接运行 run_daemon.sh,运行 launch_uengine.sh 好像不行 +echo "重启后在$HOME/uengine-launch执行run_daemon.sh或在启动器手动运行或执行命令uengine-loading-ubuntu即可打开uengine守护进程。随后即可安装和使用安卓应用" echo "你需要在每次启动安卓应用之前打开这个脚本。打开后可安全关闭" +echo "不过一般情况下会自动开启,无需手动启动。" echo "按回车重启" read reboot diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard index eaf54a7..9cb4d80 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-keyboard @@ -14,6 +14,7 @@ import traceback import ttkthemes import pyautogui import threading +import updatekiller import tkinter as tk import tkinter.ttk as ttk import tkinter.messagebox as messagebox @@ -238,4 +239,4 @@ keys.start() threading.Thread(target=ShowTips).start() pyautogui.FAILSAFE = False threading.Thread(target=RestartProgramTimer).start() -window.mainloop() \ No newline at end of file +window.mainloop() diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-loading-ubuntu.desktop b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-loading-ubuntu.desktop new file mode 100644 index 0000000..d9edeed --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-loading-ubuntu.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Categories=System; +Comment=启动 UEngine 环境(默认会开机自启动) +Encoding=UTF-8 +Exec=bash /usr/bin/uengine-loading-ubuntu +Icon=/opt/apps/com.gitee.uengine.runner.spark/files/defult.svg +MimeType= +Name=手动启动 UEngine 环境(默认会开机自启动) +StartupWMClass=手动启动 UEngine 环境(默认会开机自启动) +Terminal=false +Type=Application diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner index eb93586..9e8b173 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner @@ -26,6 +26,7 @@ import traceback import threading import webbrowser import subprocess +import updatekiller map = True import matplotlib import matplotlib.figure @@ -1099,7 +1100,7 @@ class UpdateWindow(): updateWidgetLayout = QtWidgets.QGridLayout() versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:未知\n更新内容:") updateText = QtWidgets.QTextBrowser() - ok = QtWidgets.QPushButton("更新(更新过程中会关闭所有Python应用,包括这个应用)") + ok = QtWidgets.QPushButton("更新(更新过程中会关闭这个应用的所有进程)") ok.clicked.connect(UpdateWindow.Update) cancel = QtWidgets.QPushButton("取消") cancel.clicked.connect(UpdateWindow.update.close) @@ -1134,8 +1135,8 @@ class UpdateWindow(): write_txt("/tmp/uengine-runner/update.sh", f"""#!/bin/bash echo 删除多余的安装包 rm -rfv /tmp/uengine-runner/update/* -echo 关闭“UEngine 运行器”以及其它“Python 应用” -killall python3 +echo 关闭“UEngine 运行器” +python3 {programPath}/updatekiller.py echo 下载安装包 wget -P /tmp/uengine-runner/update {UpdateWindow.data["Url"][0]} echo 安装安装包 @@ -1494,13 +1495,14 @@ aaptVersion = GetCommandReturn("aapt version") SystemVersion = GetSystemVersion() iconPath = "{}/runner.svg".format(os.path.split(os.path.realpath(__file__))[0]) about = f'''

-

介绍 :一个基于 Python3 的 PyQt5 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。

-

版本 :{version}

-

适用平台 :{goodRunSystem}

-

Qt 版本 :{QtCore.qVersion()}

-

程序官网 :{programUrl}

-

系统版本 : {SystemVersion}

-

©2021-{time.strftime("%Y")}

''' +

介绍:一个基于 Python3 的 PyQt5 制作的 UEngine 运行器,在新版本Deepin/UOS发布后,可以在应用商店安装部分官方已适配的安卓应用,对爱好者来说,不能自己安装APK软件包始终差点意思,本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包,并能发送安装的APK包启动菜单到桌面或系统菜单。

+

版本:{version}

+

适用平台:{goodRunSystem}

+

Qt 版本:{QtCore.qVersion()}

+

程序官网:{programUrl}

+

系统版本:{SystemVersion}

+

主要开发者:gfdgd xi、为什么您不喜欢熊出没和阿布呢

+

©2021-{time.strftime("%Y")} RacoonGX 团队

''' updateThingsString = "" tips = "" contribute = "" @@ -1689,7 +1691,8 @@ if not os.path.exists("/usr/bin/uengine"): else: #QtWidgets.QMessageBox.critical(None, "错误", "请安装 UEngine 后继续") #sys.exit(0) - if QtWidgets.QMessageBox.question(None, "提示", "您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n这里将会使用 shenmo 提供的脚本进行安装\n安装完后重新启动该程序即可\n提示:无法保证此安装脚本安装的 UEngine 可以使用") == QtWidgets.QMessageBox.Yes: + #if QtWidgets.QMessageBox.question(None, "提示", "您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n这里将会使用 shenmo 提供的脚本进行安装\n安装完后重新启动该程序即可\n提示:无法保证此安装脚本安装的 UEngine 可以使用") == QtWidgets.QMessageBox.Yes: + if QtWidgets.QMessageBox.question(None, "提示", "您的电脑没有安装 UEngine,是否安装 UEngine 以便更好的使用\n这里将会安装移植版本(之前由 Shenmo 编写)\n安装完后重新启动该程序即可\n提示:需要在 Ubuntu 22.04 及以上版本才能正常安装") == QtWidgets.QMessageBox.Yes: os.system(f"'{programPath}/launch.sh' deepin-terminal -C \"bash '{programPath}/uengine-installer'\"") sys.exit(0) @@ -1712,6 +1715,7 @@ FrmInstall = QtWidgets.QGridLayout() BtnFindApk = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnFindApk"]) BtnInstall = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnInstall"]) BtnShowUengineApp = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnShowUengineApp"]) +BtnAppStore = QtWidgets.QPushButton("微型应用商店") BtnUninstall = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnUninstall"]) Btngeticon = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["Btngeticon"]) BtnSaveApk = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"]["BtnSaveApk"]) @@ -1720,6 +1724,7 @@ BtnApkInformation = QtWidgets.QPushButton(langFile[lang]["Main"]["MainWindow"][" FrmInstallWidget.setLayout(FrmInstall) FrmInstallWidget.setSizePolicy(size) BtnShowUengineApp.setSizePolicy(size) +BtnAppStore.setSizePolicy(size) ComboInstallPath.setEditable(True) ComboInstallPath.addItems(findApkHistory) ComboInstallPath.setEditText("") @@ -1743,11 +1748,13 @@ BtnUninstall.clicked.connect(ButtonClick8) Btngeticon.clicked.connect(SaveIconToOtherPath) BtnSaveApk.clicked.connect(SaveInstallUengineApp) BtnApkInformation.clicked.connect(ApkInformation.ShowWindows) +BtnAppStore.clicked.connect(lambda: threading.Thread(target=os.system, args=[f"python3 '{programPath}/AutoConfig.py'"]).start()) # 布局控件 -widgetLayout.addWidget(LabApkPath, 0, 0, 1, 2) -widgetLayout.addWidget(ComboInstallPath, 1, 0, 1, 2) +widgetLayout.addWidget(LabApkPath, 0, 0, 1, 3) +widgetLayout.addWidget(ComboInstallPath, 1, 0, 1, 3) widgetLayout.addWidget(BtnShowUengineApp, 2, 0, 1, 1) -widgetLayout.addWidget(FrmInstallWidget, 0, 2, 3, 1) +widgetLayout.addWidget(BtnAppStore, 2, 1, 1, 1) +widgetLayout.addWidget(FrmInstallWidget, 0, 3, 3, 1) FrmInstall.addWidget(BtnFindApk, 0, 0, 1, 1) FrmInstall.addWidget(BtnInstall, 0, 1, 1, 1) FrmInstall.addWidget(BtnUninstall, 1, 0, 1, 1) @@ -1938,17 +1945,23 @@ uengineRunnerSearch = QtWidgets.QAction("查询指定程序在 UEngine 的运行 helpUengineRunnerBugUpload = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][2]) helpShowHelp = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][4]) helpRunnerUpdate = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][3]) +helpFen = QtWidgets.QAction("程序评分") helpAbout = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][1]) helpAboutQt = QtWidgets.QAction(langFile[lang]["Main"]["MainWindow"]["Menu"][3]["Menu"][5]) help.addAction(helpOpenProgramUrl) help.addAction(uengineRunnerSearch) help.addAction(makerWebsize) help.addAction(helpForum) +help.addSeparator() help.addAction(helpUengineRunnerBugUpload) +help.addSeparator() help.addAction(helpShowHelp) help.addAction(helpRunnerUpdate) +help.addAction(helpFen) +help.addSeparator() help.addAction(helpAbout) help.addAction(helpAboutQt) +help.addSeparator() hm1 = help.addMenu("更多生态适配应用") hm1_1 = QtWidgets.QAction("运行 Windows 应用:Wine 运行器") hm1.addAction(hm1_1) @@ -1957,10 +1970,11 @@ hm1_1.triggered.connect(lambda: webbrowser.open_new_tab("https://gitee.com/gfdgd helpOpenProgramUrl.triggered.connect(OpenProgramURL) uengineRunnerSearch.triggered.connect(lambda: webbrowser.open_new_tab("https://gfdgd-xi.github.io/uengine-runner-info/")) makerWebsize.triggered.connect(lambda: webbrowser.open_new_tab("https://gfdgd-xi.github.io")) -helpForum.triggered.connect(lambda: webbrowser.open_new_tab("https://gfdgdxi.flarum.cloud/")) +helpForum.triggered.connect(lambda: webbrowser.open_new_tab("https://bbs.racoongx.cn/")) helpUengineRunnerBugUpload.triggered.connect(UengineRunnerBugUpload) helpShowHelp.triggered.connect(ShowHelp) helpRunnerUpdate.triggered.connect(UpdateWindow.ShowWindow) +helpFen.triggered.connect(lambda: threading.Thread(target=os.system, args=[f"'{programPath}/ProgramFen.py'"]).start()) helpAbout.triggered.connect(showhelp) helpAboutQt.triggered.connect(lambda: QtWidgets.QMessageBox.aboutQt(widget)) # 设置窗口 diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about index ea82964..70208f7 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-about @@ -16,6 +16,7 @@ import time import json import ttkthemes import subprocess +import updatekiller import tkinter as tk import tkinter.ttk as ttk @@ -167,4 +168,4 @@ def showhelp(): print(windowflag) helpwindow.mainloop() #helpwindow.protocol("WM_DELETE_WINDOW", on_closing) -showhelp() \ No newline at end of file +showhelp() diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug index 143fa2c..a975ab9 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-runner-update-bug @@ -6,6 +6,7 @@ import base64 import requests import traceback import webbrowser +import updatekiller import urllib.parse as parse import PyQt5.QtGui as QtGui import PyQt5.QtWidgets as QtWidgets @@ -50,7 +51,7 @@ def OpenGitlinkIssues(): webbrowser.open_new_tab("https://www.gitlink.org.cn/gfdgd_xi/uengine-runner/issues") def OpenProgramForum(): - webbrowser.open_new_tab("https://gfdgdxi.flarum.cloud/t/bugs") + webbrowser.open_new_tab("https://bbs.racoongx.cn/t/bugs") # 获取用户主目录 def get_home()->"获取用户主目录": @@ -108,4 +109,4 @@ window.setCentralWidget(widget) window.setWindowTitle(f"UEngine 运行器 {version} 问题/建议反馈") window.setWindowIcon(QtGui.QIcon(iconPath)) window.show() -sys.exit(app.exec_()) \ No newline at end of file +sys.exit(app.exec_()) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb index 85fe2be..e0eaf6b 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-useadb @@ -6,6 +6,7 @@ import os import sys import traceback +import updatekiller import PyQt5.QtWidgets as QtWidgets ######################## # @@ -69,4 +70,4 @@ try: except: traceback.print_exc() QtWidgets.QMessageBox.information(None, "错误", traceback.format_exc()) - sys.exit(2) \ No newline at end of file + sys.exit(2) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py index 28e8136..4178d1d 100755 --- a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/uengine-window-size-setting.py @@ -3,6 +3,7 @@ import os import sys import shutil import traceback +import updatekiller def Add(): try: @@ -41,4 +42,4 @@ if __name__ == "__main__": Del() sys.exit(0) print("参数错误!") - sys.exit(1) \ No newline at end of file + sys.exit(1) diff --git a/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/updatekiller.py b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/updatekiller.py new file mode 100755 index 0000000..962aee4 --- /dev/null +++ b/new-deb-build/opt/apps/com.gitee.uengine.runner.spark/files/updatekiller.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +import sys +import os +import atexit + +PIDFILE = '/tmp/uengine-runner.pid' + +#程序结束时清理pid +@atexit.register +def remove_pid(): + with open(PIDFILE) as pidfile: + pidlst = pidfile.readlines() + pidlst.remove(str(PID)+'\n') + with open(PIDFILE,'w') as pidfile: + pidfile.writelines(pidlst) + +#更新时结束进程 +def main(): + for i in open(PIDFILE): + try: + os.kill(int(i),15) + except ProcessLookupError: + pass + os.remove(PIDFILE) + +#当该程序被直接执行时,执行结束进程操作。如果是导入的形式,则只是记录pid +if __name__ == '__main__': + sys.exit(main()) +else: + #获取进程pid,用于更新时结束进程 + PID = os.getpid() + with open(PIDFILE,'a') as pidfile: + print(PID,file=pidfile) #使用print可以在行末输出换行符,而且可以省去类型转换