1.5.3完成

This commit is contained in:
gfdgd xi 2021-12-12 12:33:21 +08:00
parent 2abc67e426
commit 09857468f7
25 changed files with 261 additions and 323 deletions

View File

@ -1,9 +1,9 @@
# uengine 运行器 1.5.2 # uengine 运行器 1.5.3
### 介绍 ### 介绍
        新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。         新版本Deepin/UOS发布后可以在应用商店安装部分官方已适配的安卓应用对爱好者来说不能自己安装APK软件包始终差点意思本程序可以为Deepin/UOS上的UEngine安卓运行环境安装自定义APK软件包并能发送安装的APK包启动菜单到桌面或系统菜单。
![1.5.2](https://storage.deepin.org/thread/202111281607295590_截图_选择区域_20211128160706.png) ![1.5.3](https://storage.deepin.org/thread/202112121231595786_截图_选择区域_20211212123106.png)
测试平台UOS 家庭版deepin 20.2.2,UOS 专业版 1040 测试平台UOS 家庭版 21.1deepin 20.3,UOS 专业版 1040
(自己美术功底太差,图标直接用 anbox 的了) (自己美术功底太差,图标直接用 anbox 的了)
## 安装前必读 ## 安装前必读
@ -15,10 +15,11 @@
### 更新内容 ### 更新内容
#### V1.5.32021-12-12DDUC11版未完全完工 #### V1.5.32021-12-12DDUC11版未完全完工
##### 更新内容 ##### 更新内容
**※1、“添加/删除 UEngine 图标”窗口的写入按钮在目录**`~/.local/share/icons/hicolor/256x256/apps`**不存在时点击无反应参考报错1.5.3-1** **※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题**
**※2、修复了“UEngine APK 应用打包器”打包的deb包的.desktop文件的**`Icon`**和**`Exec`**字段有误的问题以及使用“使用前缀uengine-dc”前缀的问题** **※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录**`~/.local/share/icons/hicolor/256x256/apps`**不存在时点击无反应参考报错1.5.3-1**
3、“UEngine APK 应用打包器”支持打包完后自动删除临时目录 **※3、修复了“UEngine APK 应用打包器”打包的deb包的.desktop文件的**`Icon`**和**`Exec`**字段有误的问题以及使用“使用前缀uengine-dc”前缀的问题**
4、“UEngine APK 应用打包器”以及“添加/删除 UEngine 图标”支持在运行出现错误时显示报错 4、“UEngine APK 应用打包器”支持打包完后自动删除临时目录
5、“UEngine APK 应用打包器”以及“添加/删除 UEngine 图标”支持在运行出现错误时显示报错
##### 报错: ##### 报错:
*1.5.3-1* *1.5.3-1*
```bash ```bash
@ -34,6 +35,8 @@ Traceback (most recent call last):
with open(dst, 'wb') as fdst: with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/gfdgd_xi/.local/share/icons/hicolor/256x256/apps/com.miHoYo.cloudgames.ys.png' FileNotFoundError: [Errno 2] No such file or directory: '/home/gfdgd_xi/.local/share/icons/hicolor/256x256/apps/com.miHoYo.cloudgames.ys.png'
``` ```
##### 截图
![1.5.3](https://storage.deepin.org/thread/202112121231595786_截图_选择区域_20211212123106.png)
#### V1.5.22021-11-28 #### V1.5.22021-11-28
**※1、支持安装和构建带 Root 的 UEngine 的镜像** **※1、支持安装和构建带 Root 的 UEngine 的镜像**

View File

@ -1,5 +1,5 @@
Package: spark-uengine-runner Package: spark-uengine-runner
Version: 1.5.2 Version: 1.5.3
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com> Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>
Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner] Homepage: [https://gitee.com/gfdgd-xi/uengine-runner, https://github.com/gfdgd-xi/uengine-runner]
Architecture: all Architecture: all

View File

@ -7,4 +7,4 @@ python3 -m pip install --upgrade requests -i http://mirrors.aliyun.com/pypi/si
# 刷新图标缓存 # 刷新图标缓存
gtk-update-icon-cache /usr/share/icons/bloom gtk-update-icon-cache /usr/share/icons/bloom
# 向服务器返回安装数加1不显示内容且忽略错误 # 向服务器返回安装数加1不显示内容且忽略错误
curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.2 -s > /dev/null | true curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.3 -s > /dev/null | true

View File

@ -3,31 +3,33 @@
"https://gitee.com/gfdgd-xi/uengine-runner", "https://gitee.com/gfdgd-xi/uengine-runner",
"https://github.com/gfdgd-xi/uengine-runner" "https://github.com/gfdgd-xi/uengine-runner"
], ],
"Version": "1.5.2", "Version": "1.5.3",
"System": "Linuxdeepin/UOS", "System": "Linuxdeepin/UOS",
"Tips": [ "Tips": [
"更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis", "更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"",
"安装APK点浏览按钮选中需要安装的APK然后点安装按钮", "安装APK点浏览按钮选中需要安装的APK然后点安装按钮",
"",
"卸载APK在卸载APK下面的输入框内输入需要卸载的APK包名点卸载按钮如果无法获取包名可以通过浏览APK文件程序自动获取包名进行卸载。", "卸载APK在卸载APK下面的输入框内输入需要卸载的APK包名点卸载按钮如果无法获取包名可以通过浏览APK文件程序自动获取包名进行卸载。",
"",
"保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可", "保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可",
"",
"重置删除UEngine数据点击菜单栏的“UEngine”的“清空UEngine数据”输入密码重启即可", "重置删除UEngine数据点击菜单栏的“UEngine”的“清空UEngine数据”输入密码重启即可",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载UEngine配置了", " 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载UEngine配置了",
"",
"打开UEngine应用列表打开系统已安装的应用列表安卓界面", "打开UEngine应用列表打开系统已安装的应用列表安卓界面",
"",
"提示:", "提示:",
"1、需要你有使用 root 权限的能力;", "※1、近期升级的 UEngine 安装时会自动把要安装的 apk 删除,如果这个 apk 文件非常重要请拷贝一个备份版并安装这个备份版",
"2、需要安装 UEngine 才能使用;", "2、需要你有使用 root 权限的能力;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;", "3、需要安装 UEngine 才能使用;",
"4、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁" "4、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
"5、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁"
], ],
"Update": [ "Update": [
"V1.5.3",
"※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题",
"※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应参考报错",
"※3、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀uengine-dc”前缀的问题",
"4、“UEngine APK应用打包器”支持打包完后自动删除临时目录",
"5、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错",
"",
"V1.5.2", "V1.5.2",
"※1、支持安装和构建带 Root 的 UEngine 的镜像", "※1、支持安装和构建带Root的UEngine的镜像",
"2、更新了反馈链接", "2、更新了反馈链接",
"", "",
"V1.5.1", "V1.5.1",

View File

@ -1,6 +0,0 @@
{
"Package": "com.gitee.uengine.runner.spark",
"Update": true,
"Version": "1.5.1",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}

View File

@ -1,7 +0,0 @@
{
"Package": "spark-uengine-runner",
"Update": true,
"Version": "1.5.1",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.5.1 # 版本1.5.3
# 更新时间2021年10月06日 # 更新时间2021年12月12日DDUC11了
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -43,12 +43,20 @@ def BuildDeb():
messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK") messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK")
return return
DisabledAndEnbled(True) DisabledAndEnbled(True)
threading.Thread(target=BuildApkDeb, args=(combobox1.get(),)).start() threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start()
def RunCommandShow(command): def RunCommandShow(command):
TextboxAddText1("$> {}".format(command)) TextboxAddText1("$> {}".format(command))
TextboxAddText1(GetCommandReturn(command)) TextboxAddText1(GetCommandReturn(command))
def GetBuildApkDebError(apkPath):
try:
BuildApkDeb(apkPath)
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
DisabledAndEnbled(False)
def BuildApkDeb(apkPath): def BuildApkDeb(apkPath):
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
RunCommandShow("echo '======================================New===================================='") RunCommandShow("echo '======================================New===================================='")
@ -58,11 +66,12 @@ def BuildApkDeb(apkPath):
RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath)) RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath)) RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'") RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
apkPackageName = GetApkPackageName(apkPath) apkPackageName = GetApkPackageName(apkPath, False)
apkPackageNameNew = GetApkPackageName(apkPath, True)
apkPackageVersion = GetApkVersion(apkPath) apkPackageVersion = GetApkVersion(apkPath)
apkChineseLabel = GetApkChineseLabel(apkPath) apkChineseLabel = GetApkChineseLabel(apkPath)
apkActivityName = GetApkActivityName(apkPath) apkActivityName = GetApkActivityName(apkPath)
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageName) iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew)
debControl = '''Package: {} debControl = '''Package: {}
Version: {} Version: {}
Architecture: all Architecture: all
@ -70,82 +79,66 @@ Maintainer: {}
Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1) Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1)
Section: utils Section: utils
Priority: optional Priority: optional
Description: {}\n'''.format(apkPackageName, apkPackageVersion, apkChineseLabel, apkChineseLabel) Description: {}\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel)
debPostinst = '''#!/bin/sh debPostinst = '''#!/bin/sh
APK_DIR="/usr/share/uengine/apk" APK_DIR="/usr/share/uengine/apk"
APK_NAME="{}.apk" APK_NAME="{}"
APK_PATH="$APK_DIR/$APK_NAME" APK_PATH="$APK_DIR/$APK_NAME"
DESKTOP_FILE="/usr/share/applications/{}.desktop" DESKTOP_FILE="{}"
ICON_FILE="/usr/share/uengine/icons/{}.png"
if [ -f $APK_PATH ]; then if [ -f $APK_PATH ]; then
echo "Installing $APK_NAME" echo "Installing $APK_NAME"
else else
echo "ERROR: $APK_NAME file not found." echo "ERROR: $APK_NAME does not exist."
exit 1 exit 0
fi fi
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
if test -z "$session_manager"; then if test -z "$session_manager"; then
echo "ERROR: app install failed(session-manager not start)." echo "ERROR: app install failed(session-manager is not running)."
#sudo rm -f $DESKTOP_FILE sess_dir="/usr/share/uengine/session_install"
#sudo rm -f $ICON_FILE if [ ! -d $sess_dir ]; then
#sudo rm -f "$APK_PATH" mkdir $sess_dir
exit 1 chmod 777 $sess_dir
fi
apk_name=${{APK_PATH##*/}}
fileName="$sess_dir/$apk_name"
echo $DESKTOP_FILE > $fileName
abistr=""
if test -n "$abistr"; then
abi=`echo $abistr |awk -F \= '{{print $2}}'`
echo $abi >> $fileName
fi
chmod 766 $fileName
fi fi
ret=`/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"` /usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"
if [ $? -ne 0 ]; then
echo "ERROR: apk install error..."
#sudo rm -f $DESKTOP_FILE
#sudo rm -f $ICON_FILE
#sudo rm -f "$APK_PATH"
exit 1
fi
chkfail=`echo $ret |grep "Failed"`
if test -n "$chkfail" ; then
echo "ERROR: $ret"
#sudo rm -f $DESKTOP_FILE
#sudo rm -f $ICON_FILE
#sudo rm -f "$APK_PATH"
exit 1
fi
sudo rm -f "$APK_PATH" exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
exit 0'''.format(apkPackageName, apkPackageName, apkPackageName)
debPrerm = '''#!/bin/sh debPrerm = '''#!/bin/sh
APP_NAME="{}" APP_NAME="{}"
DESKTOP_FILE="{}"
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
if test -z "$session_manager"; then if test -z "$session_manager"; then
echo "ERROR: app install failed(session-manager not start)." echo "ERROR: app uninstall failed(session-manager is not running)."
exit 1 sess_dir="/usr/share/uengine/session_uninstall"
if [ ! -d $sess_dir ]; then
mkdir $sess_dir
chmod 777 $sess_dir
fi
fileName="$sess_dir/$APP_NAME"
echo $DESKTOP_FILE > $fileName
chmod 766 $fileName
fi fi
echo "Uninstalling $APP_NAME" echo "Uninstalling $APP_NAME"
ret=`/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"` /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"
if [ $? -ne 0 ]; then
echo "ERROR: app uninstall error..."
exit 1
fi
chkfail=`echo $ret |grep "Failed"`
if test -n "$chkfail" ; then
echo "ERROR: $ret"
exit 1
fi
cat /etc/passwd | awk -F: '$3>=1000' | cut -f 1 -d : | while read line exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
do
inifile="/home/$line/.config/uengineAppGeometry.ini"
if [ -f $inifile ]; then
sed -i "/$APP_NAME/d" $inifile
fi
done
exit 0'''.format(apkPackageName)
desktopFile = '''[Desktop Entry] desktopFile = '''[Desktop Entry]
Categories=Other; Categories=Other;
Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={}
@ -162,20 +155,22 @@ Name={}
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst) write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath)) RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm) write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageName)) RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew))
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName), desktopFile) #write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile)
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, iconSavePath, BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew),
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName)) "{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew))
RunCommandShow("echo '复制文件'") RunCommandShow("echo '复制文件'")
RunCommandShow("echo '写入 APK 软件图标'") RunCommandShow("echo '写入 APK 软件图标'")
SaveApkIcon(apkPath, iconSavePath) SaveApkIcon(apkPath, iconSavePath)
RunCommandShow("echo '复制 APK 文件'") RunCommandShow("echo '复制 APK 文件'")
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageName)) RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew))
RunCommandShow("echo '正在设置文件权限……'") RunCommandShow("echo '正在设置文件权限……'")
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath)) RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath)) RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
RunCommandShow("echo '打包 deb 到桌面……'") RunCommandShow("echo '打包 deb 到桌面……'")
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageName, apkPackageVersion)) RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion))
RunCommandShow("echo '正在删除临时目录……'")
RunCommandShow("rm -rfv '{}'".format(tempPath))
RunCommandShow("echo '完成!'") RunCommandShow("echo '完成!'")
findApkHistory.append(apkPath) findApkHistory.append(apkPath)
combobox1['value'] = findApkHistory combobox1['value'] = findApkHistory
@ -260,7 +255,7 @@ def GetApkActivityName(apkFilePath):
line = line.replace("icon=", "") line = line.replace("icon=", "")
return line return line
def GetApkPackageName(apkFilePath): def GetApkPackageName(apkFilePath, setting):
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数 # 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
info = GetApkInformation(apkFilePath) info = GetApkInformation(apkFilePath)
for line in info.split('\n'): for line in info.split('\n'):
@ -271,7 +266,7 @@ def GetApkPackageName(apkFilePath):
line = line.replace("'", "") line = line.replace("'", "")
line = line.replace(" ", "") line = line.replace(" ", "")
# 此较为特殊,因为需要判断用户是否要添加前缀 # 此较为特殊,因为需要判断用户是否要添加前缀
if qianZhui.get() == True: if setting:
return "uengine-dc-{}".format(line).lower() return "uengine-dc-{}".format(line).lower()
return line.lower() return line.lower()
@ -294,7 +289,7 @@ def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath)
[Desktop Entry] [Desktop Entry]
Categories=app; Categories=app;
Encoding=UTF-8 Encoding=UTF-8
Exec=/usr/bin/uengine launch.sh --action=android.intent.action.MAIN --package={} --component={} Exec=/usr/bin/uengine launch --action=android.intent.action.MAIN --package={} --component={}
GenericName={} GenericName={}
Icon={} Icon={}
MimeType= MimeType=

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi<3025613752@qq.com> # 作者gfdgd xi<3025613752@qq.com>
# 版本1.5.1 # 版本1.5.3
# 更新时间2021年10月05日国庆了) # 更新时间2021年12月12日DDUC11了)
# 感谢anbox、deepin 和 UOS # 感谢anbox、deepin 和 UOS
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
# 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com> # 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>
@ -35,8 +35,9 @@ from getxmlimg import getsavexml
# 卸载程序 # 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序": def UninstallProgram(package: "apk 包名")->"卸载程序":
try: try:
global fineUninstallApkHistory global fineUninstallApkHistory
Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package)) Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
print(Return)
if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)): if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)):
os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package)) os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package))
if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)): if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)):
@ -104,15 +105,13 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
os.makedirs("{}/.local/share/applications/uengine/".format(get_home())) os.makedirs("{}/.local/share/applications/uengine/".format(get_home()))
print("start install apk") print("start install apk")
global findApkHistory global findApkHistory
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
print(commandReturn)
print("start install apk12") print("start install apk12")
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path)) iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path))
tempstr1 = iconSavePath tempstr1 = iconSavePath
print("start install apk1") print("start install apk1")
iconSaveDir = os.path.dirname(iconSavePath) iconSaveDir = os.path.dirname(iconSavePath)
if not os.path.exists(iconSaveDir): if not os.path.exists(iconSaveDir):
os.makedirs(iconSaveDir,exist_ok=True) os.makedirs(iconSaveDir,exist_ok=True)
SaveApkIcon(path, iconSavePath) SaveApkIcon(path, iconSavePath)
print("start install apk2") print("start install apk2")
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
@ -120,6 +119,8 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
print("start install apk3") print("start install apk3")
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path))) "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path)))
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
print(commandReturn)
print("\nprint install complete") print("\nprint install complete")
if quit: if quit:
print(commandReturn) print(commandReturn)
@ -857,31 +858,42 @@ class AddNewUengineDesktopLink():
# 添加快捷方式 # 添加快捷方式
def SaveDesktopLink(): def SaveDesktopLink():
if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): try:
if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"): if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
return if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"):
global activityName return
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get()) if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())):
shutil.copy(programPath + "/defult.png", iconSavePath) os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home()))
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath, global activityName
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())) iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get())
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath, shutil.copy(programPath + "/defult.png", iconSavePath)
"{}/{}.desktop".format(get_desktop_path(), packageName.get())) BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
AddNewUengineDesktopLink.SaveHistory() "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
messagebox.showinfo(title="提示", message="创建完毕!") BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
"{}/{}.desktop".format(get_desktop_path(), packageName.get()))
AddNewUengineDesktopLink.SaveHistory()
messagebox.showinfo(title="提示", message="创建完毕!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
# 删除快捷方式 # 删除快捷方式
def DelDesktopLink(): def DelDesktopLink():
global packageName
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
return
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return
try: try:
os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())) global packageName
AddNewUengineDesktopLink.SaveHistory() if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
messagebox.showinfo(title="提示", message="已删除") messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
return
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return
try:
os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
AddNewUengineDesktopLink.SaveHistory()
messagebox.showinfo(title="提示", message="已删除")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
except: except:
traceback.print_exc() traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc()) messagebox.showerror(title="错误", message=traceback.format_exc())
@ -954,7 +966,7 @@ Tk 版本 :{}
程序官网 {} 程序官网 {}
系统版本 :{} 系统版本 : {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y")) ©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y"))
tips = "\n".join(information["Tips"]) tips = "\n".join(information["Tips"])

View File

@ -66,14 +66,14 @@ starValue.set("5分")
name = ttk.Label(win, text="你的昵称:") name = ttk.Label(win, text="你的昵称:")
nameThings = ttk.Entry(win, width=25) nameThings = ttk.Entry(win, width=25)
contact = ttk.Label(win, text="联系方式:") contact = ttk.Label(win, text="联系方式(电子邮箱)")
contactThings = ttk.Entry(win, width=25) contactThings = ttk.Entry(win, width=25)
star = ttk.Label(win, text="评分:") star = ttk.Label(win, text="评分:")
starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分") starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分")
updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):") updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):")
updateThings = tk.Text(win) updateThings = tk.Text(win, width=100)
otherUpload = ttk.Frame(win) otherUpload = ttk.Frame(win)
# 所属内容 # 所属内容
@ -106,7 +106,7 @@ starMenu.grid(row=0, column=5)
updateThingsTips.grid(row=1, column=0, columnspan=2) updateThingsTips.grid(row=1, column=0, columnspan=2)
updateThings.grid(row=2, column=0, columnspan=6) updateThings.grid(row=2, column=0, columnspan=6)
otherUpload.grid(row=3, column=0, columnspan=4) otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W)
updateButton.grid(row=3, column=5) updateButton.grid(row=3, column=5)
win.pack(expand="yes", fill="both") win.pack(expand="yes", fill="both")

Binary file not shown.

View File

@ -21,11 +21,12 @@
"5、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁" "5、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁"
], ],
"Update": [ "Update": [
"V1.5.3(未完全完工):", "V1.5.3",
"※1、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应参考报错", "※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题",
"※2、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀uengine-dc”前缀的问题", "※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应参考报错",
"3、“UEngine APK应用打包器”支持打包完后自动删除临时目录", "※3、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀uengine-dc”前缀的问题",
"4、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错", "4、“UEngine APK应用打包器”支持打包完后自动删除临时目录",
"5、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错",
"", "",
"V1.5.2", "V1.5.2",
"※1、支持安装和构建带Root的UEngine的镜像", "※1、支持安装和构建带Root的UEngine的镜像",

View File

@ -35,8 +35,9 @@ from getxmlimg import getsavexml
# 卸载程序 # 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序": def UninstallProgram(package: "apk 包名")->"卸载程序":
try: try:
global fineUninstallApkHistory global fineUninstallApkHistory
Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package)) Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
print(Return)
if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)): if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)):
os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package)) os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package))
if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)): if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)):

View File

@ -1,6 +1,6 @@
Package: com.gitee.uengine.runner.spark Package: com.gitee.uengine.runner.spark
Source: com.gitee.uengine.runner.spark Source: com.gitee.uengine.runner.spark
Version: 1.5.2 Version: 1.5.3
Architecture: all Architecture: all
Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com> Maintainer: gfdgd xi <3025613752@qq.com>, actionchen<917981399@qq.com>
Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, uengine, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell, python3-xlib Depends: deepin-elf-verify (>= 0.0.16.7-1), python3, python3-tk, python3-pip, aapt, uengine, python3-setuptools, deepin-terminal, curl, python3-pil, python3-pil.imagetk, python3-requests, adb, translate-shell, python3-xlib

View File

@ -19,4 +19,4 @@ ln -s /opt/apps/com.gitee.uengine.runner.spark/files/root-uengine
# 刷新图标缓存 # 刷新图标缓存
#gtk-update-icon-cache /usr/share/icons/bloom #gtk-update-icon-cache /usr/share/icons/bloom
# 向服务器返回安装数加1不显示内容且忽略错误 # 向服务器返回安装数加1不显示内容且忽略错误
curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.2 -s > /dev/null | true curl http://120.25.153.144/uengine-runner/Install.php?Version=1.5.3 -s > /dev/null | true

View File

@ -3,31 +3,33 @@
"https://gitee.com/gfdgd-xi/uengine-runner", "https://gitee.com/gfdgd-xi/uengine-runner",
"https://github.com/gfdgd-xi/uengine-runner" "https://github.com/gfdgd-xi/uengine-runner"
], ],
"Version": "1.5.2", "Version": "1.5.3",
"System": "Linuxdeepin/UOS", "System": "Linuxdeepin/UOS",
"Tips": [ "Tips": [
"更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis", "更多可见https://gitee.com/gfdgd-xi/uengine-runner/wikis",
"",
"安装APK点浏览按钮选中需要安装的APK然后点安装按钮", "安装APK点浏览按钮选中需要安装的APK然后点安装按钮",
"",
"卸载APK在卸载APK下面的输入框内输入需要卸载的APK包名点卸载按钮如果无法获取包名可以通过浏览APK文件程序自动获取包名进行卸载。", "卸载APK在卸载APK下面的输入框内输入需要卸载的APK包名点卸载按钮如果无法获取包名可以通过浏览APK文件程序自动获取包名进行卸载。",
"",
"保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可", "保存APK图标在安装APK下面的输入框浏览或输入APK的路径然后点击“保存图标”按钮选择保存位置即可",
"",
"重置删除UEngine数据点击菜单栏的“UEngine”的“清空UEngine数据”输入密码重启即可", "重置删除UEngine数据点击菜单栏的“UEngine”的“清空UEngine数据”输入密码重启即可",
" 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载UEngine配置了", " 注意如果任何安卓一遍打不开多打开几遍应该就可以重新加载UEngine配置了",
"",
"打开UEngine应用列表打开系统已安装的应用列表安卓界面", "打开UEngine应用列表打开系统已安装的应用列表安卓界面",
"",
"提示:", "提示:",
"1、需要你有使用 root 权限的能力;", "※1、近期升级的 UEngine 安装时会自动把要安装的 apk 删除,如果这个 apk 文件非常重要请拷贝一个备份版并安装这个备份版",
"2、需要安装 UEngine 才能使用;", "2、需要你有使用 root 权限的能力;",
"3、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;", "3、需要安装 UEngine 才能使用;",
"4、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁" "4、提取 apk 图标的 apk 路径以“安装 apk”那栏为准;",
"5、如果想要使用adb连接UEngine或其他手机请使用 1.2.0 以前的版本。如需连接UEngine请安装adb补丁"
], ],
"Update": [ "Update": [
"V1.5.3",
"※1、修复了在 UOS 家庭版安装 apk 文件安装包信息为 None 的问题",
"※2、“添加/删除 UEngine 图标”窗口的写入按钮在目录~/.local/share/icons/hicolor/256x256/apps不存在时点击无反应参考报错",
"※3、修复了“UEngine APK应用打包器”打包的deb包的.desktop文件的Icon和Exec字段有误的问题以及使用“使用前缀uengine-dc”前缀的问题",
"4、“UEngine APK应用打包器”支持打包完后自动删除临时目录",
"5、“UEngine APK应用打包器”以及“添加/删除UEngine图标”支持在运行出现错误时显示报错",
"",
"V1.5.2", "V1.5.2",
"※1、支持安装和构建带 Root 的 UEngine 的镜像", "※1、支持安装和构建带Root的UEngine的镜像",
"2、更新了反馈链接", "2、更新了反馈链接",
"", "",
"V1.5.1", "V1.5.1",

View File

@ -1,6 +0,0 @@
{
"Package": "com.gitee.uengine.runner.spark",
"Update": true,
"Version": "1.5.1",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}

View File

@ -1,7 +0,0 @@
{
"Package": "spark-uengine-runner",
"Update": true,
"Version": "1.5.1",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
}

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi # 作者gfdgd xi
# 版本1.5.1 # 版本1.5.3
# 更新时间2021年10月06日 # 更新时间2021年12月12日DDUC11了
# 感谢anbox、deepin 和 统信 # 感谢anbox、deepin 和 统信
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
########################################################################################### ###########################################################################################
@ -43,12 +43,20 @@ def BuildDeb():
messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK") messagebox.showerror(title="提示", message="信息填写错误,无法继续打包 APK")
return return
DisabledAndEnbled(True) DisabledAndEnbled(True)
threading.Thread(target=BuildApkDeb, args=(combobox1.get(),)).start() threading.Thread(target=GetBuildApkDebError, args=(combobox1.get(),)).start()
def RunCommandShow(command): def RunCommandShow(command):
TextboxAddText1("$> {}".format(command)) TextboxAddText1("$> {}".format(command))
TextboxAddText1(GetCommandReturn(command)) TextboxAddText1(GetCommandReturn(command))
def GetBuildApkDebError(apkPath):
try:
BuildApkDeb(apkPath)
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
DisabledAndEnbled(False)
def BuildApkDeb(apkPath): def BuildApkDeb(apkPath):
tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024))) tempPath = "/tmp/uengine-apk-builder-{}".format(int(random.randint(0, 1024)))
RunCommandShow("echo '======================================New===================================='") RunCommandShow("echo '======================================New===================================='")
@ -58,11 +66,12 @@ def BuildApkDeb(apkPath):
RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath)) RunCommandShow("mkdir -pv '{}/usr/share/uengine/apk'".format(tempPath))
RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath)) RunCommandShow("mkdir -pv '{}/usr/share/uengine/icons'".format(tempPath))
RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'") RunCommandShow("echo '写入文件,因为写入过程过于复杂,不显示写入命令……'")
apkPackageName = GetApkPackageName(apkPath) apkPackageName = GetApkPackageName(apkPath, False)
apkPackageNameNew = GetApkPackageName(apkPath, True)
apkPackageVersion = GetApkVersion(apkPath) apkPackageVersion = GetApkVersion(apkPath)
apkChineseLabel = GetApkChineseLabel(apkPath) apkChineseLabel = GetApkChineseLabel(apkPath)
apkActivityName = GetApkActivityName(apkPath) apkActivityName = GetApkActivityName(apkPath)
iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageName) iconSavePath = "{}/usr/share/uengine/icons/{}.png".format(tempPath, apkPackageNameNew)
debControl = '''Package: {} debControl = '''Package: {}
Version: {} Version: {}
Architecture: all Architecture: all
@ -70,82 +79,66 @@ Maintainer: {}
Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1) Depends: deepin-elf-verify (>= 0.0.16.7-1), uengine (>= 1.0.1)
Section: utils Section: utils
Priority: optional Priority: optional
Description: {}\n'''.format(apkPackageName, apkPackageVersion, apkChineseLabel, apkChineseLabel) Description: {}\n'''.format(apkPackageNameNew, apkPackageVersion, apkChineseLabel, apkChineseLabel)
debPostinst = '''#!/bin/sh debPostinst = '''#!/bin/sh
APK_DIR="/usr/share/uengine/apk" APK_DIR="/usr/share/uengine/apk"
APK_NAME="{}.apk" APK_NAME="{}"
APK_PATH="$APK_DIR/$APK_NAME" APK_PATH="$APK_DIR/$APK_NAME"
DESKTOP_FILE="/usr/share/applications/{}.desktop" DESKTOP_FILE="{}"
ICON_FILE="/usr/share/uengine/icons/{}.png"
if [ -f $APK_PATH ]; then if [ -f $APK_PATH ]; then
echo "Installing $APK_NAME" echo "Installing $APK_NAME"
else else
echo "ERROR: $APK_NAME file not found." echo "ERROR: $APK_NAME does not exist."
exit 1 exit 0
fi fi
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
if test -z "$session_manager"; then if test -z "$session_manager"; then
echo "ERROR: app install failed(session-manager not start)." echo "ERROR: app install failed(session-manager is not running)."
#sudo rm -f $DESKTOP_FILE sess_dir="/usr/share/uengine/session_install"
#sudo rm -f $ICON_FILE if [ ! -d $sess_dir ]; then
#sudo rm -f "$APK_PATH" mkdir $sess_dir
exit 1 chmod 777 $sess_dir
fi
apk_name=${{APK_PATH##*/}}
fileName="$sess_dir/$apk_name"
echo $DESKTOP_FILE > $fileName
abistr=""
if test -n "$abistr"; then
abi=`echo $abistr |awk -F \= '{{print $2}}'`
echo $abi >> $fileName
fi
chmod 766 $fileName
fi fi
ret=`/usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"` /usr/bin/uengine-session-launch-helper -- uengine install --apk="$APK_PATH"
if [ $? -ne 0 ]; then
echo "ERROR: apk install error..."
#sudo rm -f $DESKTOP_FILE
#sudo rm -f $ICON_FILE
#sudo rm -f "$APK_PATH"
exit 1
fi
chkfail=`echo $ret |grep "Failed"`
if test -n "$chkfail" ; then
echo "ERROR: $ret"
#sudo rm -f $DESKTOP_FILE
#sudo rm -f $ICON_FILE
#sudo rm -f "$APK_PATH"
exit 1
fi
sudo rm -f "$APK_PATH" exit 0'''.format(apkPackageNameNew + ".apk", "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
exit 0'''.format(apkPackageName, apkPackageName, apkPackageName)
debPrerm = '''#!/bin/sh debPrerm = '''#!/bin/sh
APP_NAME="{}" APP_NAME="{}"
DESKTOP_FILE="{}"
session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep` session_manager=`ps -ef | grep "uengine session-manager" | grep -v grep`
if test -z "$session_manager"; then if test -z "$session_manager"; then
echo "ERROR: app install failed(session-manager not start)." echo "ERROR: app uninstall failed(session-manager is not running)."
exit 1 sess_dir="/usr/share/uengine/session_uninstall"
if [ ! -d $sess_dir ]; then
mkdir $sess_dir
chmod 777 $sess_dir
fi
fileName="$sess_dir/$APP_NAME"
echo $DESKTOP_FILE > $fileName
chmod 766 $fileName
fi fi
echo "Uninstalling $APP_NAME" echo "Uninstalling $APP_NAME"
ret=`/usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"` /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg="$APP_NAME"
if [ $? -ne 0 ]; then
echo "ERROR: app uninstall error..."
exit 1
fi
chkfail=`echo $ret |grep "Failed"`
if test -n "$chkfail" ; then
echo "ERROR: $ret"
exit 1
fi
cat /etc/passwd | awk -F: '$3>=1000' | cut -f 1 -d : | while read line exit 0'''.format(apkPackageName, "/usr/share/applications/{}.desktop".format(apkPackageNameNew))
do
inifile="/home/$line/.config/uengineAppGeometry.ini"
if [ -f $inifile ]; then
sed -i "/$APP_NAME/d" $inifile
fi
done
exit 0'''.format(apkPackageName)
desktopFile = '''[Desktop Entry] desktopFile = '''[Desktop Entry]
Categories=Other; Categories=Other;
Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={} Exec=uengine launch --action=android.intent.action.MAIN --package={} --component={}
@ -162,20 +155,22 @@ Name={}
write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst) write_txt("{}/DEBIAN/postinst".format(tempPath), debPostinst)
RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath)) RunCommandShow("echo 正在写入文件:'{}/DEBIAN/prerm'".format(tempPath))
write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm) write_txt("{}/DEBIAN/prerm".format(tempPath), debPrerm)
RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageName)) RunCommandShow("echo 正在写入文件:'/usr/share/applications/{}.desktop'".format(apkPackageNameNew))
#write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName), desktopFile) #write_txt("{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew), desktopFile)
BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, iconSavePath, BuildUengineDesktop(apkPackageName, apkActivityName, apkChineseLabel, "/usr/share/uengine/icons/{}.png".format(apkPackageNameNew),
"{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageName)) "{}/usr/share/applications/{}.desktop".format(tempPath, apkPackageNameNew))
RunCommandShow("echo '复制文件'") RunCommandShow("echo '复制文件'")
RunCommandShow("echo '写入 APK 软件图标'") RunCommandShow("echo '写入 APK 软件图标'")
SaveApkIcon(apkPath, iconSavePath) SaveApkIcon(apkPath, iconSavePath)
RunCommandShow("echo '复制 APK 文件'") RunCommandShow("echo '复制 APK 文件'")
RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageName)) RunCommandShow("cp -rv '{}' '{}/usr/share/uengine/apk/{}.apk'".format(apkPath, tempPath, apkPackageNameNew))
RunCommandShow("echo '正在设置文件权限……'") RunCommandShow("echo '正在设置文件权限……'")
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath)) RunCommandShow("chmod 0775 -vR '{}/DEBIAN/postinst'".format(tempPath))
RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath)) RunCommandShow("chmod 0775 -vR '{}/DEBIAN/prerm'".format(tempPath))
RunCommandShow("echo '打包 deb 到桌面……'") RunCommandShow("echo '打包 deb 到桌面……'")
RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageName, apkPackageVersion)) RunCommandShow("dpkg -b '{}' '{}/{}_{}.deb'".format(tempPath, get_desktop_path(),apkPackageNameNew, apkPackageVersion))
RunCommandShow("echo '正在删除临时目录……'")
RunCommandShow("rm -rfv '{}'".format(tempPath))
RunCommandShow("echo '完成!'") RunCommandShow("echo '完成!'")
findApkHistory.append(apkPath) findApkHistory.append(apkPath)
combobox1['value'] = findApkHistory combobox1['value'] = findApkHistory
@ -260,7 +255,7 @@ def GetApkActivityName(apkFilePath):
line = line.replace("icon=", "") line = line.replace("icon=", "")
return line return line
def GetApkPackageName(apkFilePath): def GetApkPackageName(apkFilePath, setting):
# 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数 # 提示:此函数有被为此程序适配而调整,如果需要最原始(无调整的)请使用主程序(此为附属组件)里的函数
info = GetApkInformation(apkFilePath) info = GetApkInformation(apkFilePath)
for line in info.split('\n'): for line in info.split('\n'):
@ -271,7 +266,7 @@ def GetApkPackageName(apkFilePath):
line = line.replace("'", "") line = line.replace("'", "")
line = line.replace(" ", "") line = line.replace(" ", "")
# 此较为特殊,因为需要判断用户是否要添加前缀 # 此较为特殊,因为需要判断用户是否要添加前缀
if qianZhui.get() == True: if setting:
return "uengine-dc-{}".format(line).lower() return "uengine-dc-{}".format(line).lower()
return line.lower() return line.lower()
@ -294,7 +289,7 @@ def BuildUengineDesktop(packageName, activityName, showName, iconPath, savePath)
[Desktop Entry] [Desktop Entry]
Categories=app; Categories=app;
Encoding=UTF-8 Encoding=UTF-8
Exec=/usr/bin/uengine launch.sh --action=android.intent.action.MAIN --package={} --component={} Exec=/usr/bin/uengine launch --action=android.intent.action.MAIN --package={} --component={}
GenericName={} GenericName={}
Icon={} Icon={}
MimeType= MimeType=

View File

@ -2,8 +2,8 @@
# 使用系统默认的 python3 运行 # 使用系统默认的 python3 运行
########################################################################################### ###########################################################################################
# 作者gfdgd xi<3025613752@qq.com> # 作者gfdgd xi<3025613752@qq.com>
# 版本1.5.1 # 版本1.5.3
# 更新时间2021年10月05日国庆了) # 更新时间2021年12月12日DDUC11了)
# 感谢anbox、deepin 和 UOS # 感谢anbox、deepin 和 UOS
# 基于 Python3 的 tkinter 构建 # 基于 Python3 的 tkinter 构建
# 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com> # 更新gfdgd xi<3025613752@qq.com>、actionchen<917981399@qq.com>
@ -35,8 +35,9 @@ from getxmlimg import getsavexml
# 卸载程序 # 卸载程序
def UninstallProgram(package: "apk 包名")->"卸载程序": def UninstallProgram(package: "apk 包名")->"卸载程序":
try: try:
global fineUninstallApkHistory global fineUninstallApkHistory
Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package)) Return = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine uninstall --pkg='{}'".format(package))
print(Return)
if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)): if os.path.exists("{}/.local/share/applications/{}.desktop".format(get_home(), package)):
os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package)) os.remove("{}/.local/share/applications/{}.desktop".format(get_home(), package))
if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)): if os.path.exists("{}/{}.desktop".format(get_desktop_path(), package)):
@ -104,15 +105,13 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
os.makedirs("{}/.local/share/applications/uengine/".format(get_home())) os.makedirs("{}/.local/share/applications/uengine/".format(get_home()))
print("start install apk") print("start install apk")
global findApkHistory global findApkHistory
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
print(commandReturn)
print("start install apk12") print("start install apk12")
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path)) iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), GetApkPackageName(path))
tempstr1 = iconSavePath tempstr1 = iconSavePath
print("start install apk1") print("start install apk1")
iconSaveDir = os.path.dirname(iconSavePath) iconSaveDir = os.path.dirname(iconSavePath)
if not os.path.exists(iconSaveDir): if not os.path.exists(iconSaveDir):
os.makedirs(iconSaveDir,exist_ok=True) os.makedirs(iconSaveDir,exist_ok=True)
SaveApkIcon(path, iconSavePath) SaveApkIcon(path, iconSavePath)
print("start install apk2") print("start install apk2")
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
@ -120,6 +119,8 @@ def InstallApk(path: "apk 路径", quit: "是否静默安装" = False):
print("start install apk3") print("start install apk3")
BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath, BuildUengineDesktop(GetApkPackageName(path), GetApkActivityName(path), GetApkChineseLabel(path), iconSavePath,
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path))) "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), GetApkPackageName(path)))
commandReturn = GetCommandReturn("pkexec /usr/bin/uengine-session-launch-helper -- uengine install --apk='{}'".format(path))
print(commandReturn)
print("\nprint install complete") print("\nprint install complete")
if quit: if quit:
print(commandReturn) print(commandReturn)
@ -857,31 +858,42 @@ class AddNewUengineDesktopLink():
# 添加快捷方式 # 添加快捷方式
def SaveDesktopLink(): def SaveDesktopLink():
if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())): try:
if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"): if os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
return if not messagebox.askokcancel(title="提示", message="文件已存在,确定要覆盖吗?"):
global activityName return
iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get()) if not os.path.exists("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home())):
shutil.copy(programPath + "/defult.png", iconSavePath) os.makedirs("{}/.local/share/icons/hicolor/256x256/apps/".format(get_home()))
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath, global activityName
"{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())) iconSavePath = "{}/.local/share/icons/hicolor/256x256/apps/{}.png".format(get_home(), packageName.get())
BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath, shutil.copy(programPath + "/defult.png", iconSavePath)
"{}/{}.desktop".format(get_desktop_path(), packageName.get())) BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
AddNewUengineDesktopLink.SaveHistory() "{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
messagebox.showinfo(title="提示", message="创建完毕!") BuildUengineDesktop(packageName.get(), activityName, packageName.get(), iconSavePath,
"{}/{}.desktop".format(get_desktop_path(), packageName.get()))
AddNewUengineDesktopLink.SaveHistory()
messagebox.showinfo(title="提示", message="创建完毕!")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
# 删除快捷方式 # 删除快捷方式
def DelDesktopLink(): def DelDesktopLink():
global packageName
if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
return
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return
try: try:
os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())) global packageName
AddNewUengineDesktopLink.SaveHistory() if not os.path.exists("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get())):
messagebox.showinfo(title="提示", message="已删除") messagebox.showerror(title="错误", message="此包名对应的 UEngine 桌面快捷方式不存在!")
return
if not messagebox.askyesno(title="提示", message="你确定要删除吗?删除后将无法恢复!"):
return
try:
os.remove("{}/.local/share/applications/uengine/{}.desktop".format(get_home(), packageName.get()))
AddNewUengineDesktopLink.SaveHistory()
messagebox.showinfo(title="提示", message="已删除")
except:
traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc())
except: except:
traceback.print_exc() traceback.print_exc()
messagebox.showerror(title="错误", message=traceback.format_exc()) messagebox.showerror(title="错误", message=traceback.format_exc())
@ -954,7 +966,7 @@ Tk 版本 :{}
程序官网 {} 程序官网 {}
系统版本 :{} 系统版本 : {}
©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y")) ©2021-{}'''.format(version, goodRunSystem, tk.TkVersion, programUrl, SystemVersion, time.strftime("%Y"))
tips = "\n".join(information["Tips"]) tips = "\n".join(information["Tips"])

View File

@ -66,14 +66,14 @@ starValue.set("5分")
name = ttk.Label(win, text="你的昵称:") name = ttk.Label(win, text="你的昵称:")
nameThings = ttk.Entry(win, width=25) nameThings = ttk.Entry(win, width=25)
contact = ttk.Label(win, text="联系方式:") contact = ttk.Label(win, text="联系方式(电子邮箱)")
contactThings = ttk.Entry(win, width=25) contactThings = ttk.Entry(win, width=25)
star = ttk.Label(win, text="评分:") star = ttk.Label(win, text="评分:")
starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分") starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分")
updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):") updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):")
updateThings = tk.Text(win) updateThings = tk.Text(win, width=100)
otherUpload = ttk.Frame(win) otherUpload = ttk.Frame(win)
# 所属内容 # 所属内容
@ -106,7 +106,7 @@ starMenu.grid(row=0, column=5)
updateThingsTips.grid(row=1, column=0, columnspan=2) updateThingsTips.grid(row=1, column=0, columnspan=2)
updateThings.grid(row=2, column=0, columnspan=6) updateThings.grid(row=2, column=0, columnspan=6)
otherUpload.grid(row=3, column=0, columnspan=4) otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W)
updateButton.grid(row=3, column=5) updateButton.grid(row=3, column=5)
win.pack(expand="yes", fill="both") win.pack(expand="yes", fill="both")

View File

@ -1,59 +0,0 @@
#!/usr/bin/env python3
import os
import sys
import json
import shutil
import requests
import traceback
# 读取文本文档
def read_txt(path):
f = open(path,"r") # 设置文件对象
str = f.read() # 获取内容
f.close() # 关闭文本对象
return str # 返回结果
def GetPackageUpdateInformation():
global setting
global package
for i in allJson['Program']:
if i['Package'] == package:
return i
try:
setting = json.loads(read_txt("{}/setting.json".format(os.path.split(os.path.realpath(__file__))[0])))
except:
traceback.print_exc()
print("配置文件无法访问!")
package = setting['Package']
nowVersion = setting['Version']
try:
jsons = requests.get(setting["Url"])
except:
traceback.print_exc()
print("服务器出现错误!")
sys.exit(1)
allJson = json.loads(jsons.text)
updateInformation = GetPackageUpdateInformation()
name = updateInformation['Name']
newVersion = updateInformation['Version']
print("更新程序:{}".format(name))
print("最新版本:{}".format(newVersion))
print("目前版本:{}".format(nowVersion))
if nowVersion == newVersion:
print("目前是最新版本,无需更新!")
quit()
print("更新内容:")
print(updateInformation['New Things'])
choose = input("更新?[Y/N]")
if choose.upper() == "N":
quit()
if os.path.exists("/tmp/update-console-{}".format(package)):
shutil.rmtree("/tmp/update-console-{}".format(package))
os.mkdir("/tmp/update-console-{}".format(package))
if updateInformation["Linux App Url"][0] == None:
print("没有可用包源")
quit()
os.system("wget '{}' -P '/tmp/update-console-{}'".format(updateInformation["Linux App Url"][0], package))
os.system("sudo dpkg -i /tmp/update-console-{}/*".format(package))
os.system("sudo apt install -f -y")

View File

@ -1,6 +1,6 @@
{ {
"Package": "com.gitee.uengine.runner.spark", "Package": "com.gitee.uengine.runner.spark",
"Update": true, "Update": true,
"Version": "1.5.1", "Version": "1.5.3",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
} }

View File

@ -1,7 +1,7 @@
{ {
"Package": "spark-uengine-runner", "Package": "spark-uengine-runner",
"Update": true, "Update": true,
"Version": "1.5.1", "Version": "1.5.3",
"Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json" "Url": "https://gfdgd-xi.github.io/update-program/data/UpdateInformation.json"
} }

Binary file not shown.

View File

@ -66,14 +66,14 @@ starValue.set("5分")
name = ttk.Label(win, text="你的昵称:") name = ttk.Label(win, text="你的昵称:")
nameThings = ttk.Entry(win, width=25) nameThings = ttk.Entry(win, width=25)
contact = ttk.Label(win, text="联系方式:") contact = ttk.Label(win, text="联系方式(电子邮箱)")
contactThings = ttk.Entry(win, width=25) contactThings = ttk.Entry(win, width=25)
star = ttk.Label(win, text="评分:") star = ttk.Label(win, text="评分:")
starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分") starMenu = ttk.OptionMenu(win, starValue, "5分", "5分", "4分", "3分", "2分", "1分")
updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):") updateThingsTips = ttk.Label(win, text="反馈内容(支持 Markdown 格式):")
updateThings = tk.Text(win) updateThings = tk.Text(win, width=100)
otherUpload = ttk.Frame(win) otherUpload = ttk.Frame(win)
# 所属内容 # 所属内容
@ -106,7 +106,7 @@ starMenu.grid(row=0, column=5)
updateThingsTips.grid(row=1, column=0, columnspan=2) updateThingsTips.grid(row=1, column=0, columnspan=2)
updateThings.grid(row=2, column=0, columnspan=6) updateThings.grid(row=2, column=0, columnspan=6)
otherUpload.grid(row=3, column=0, columnspan=4) otherUpload.grid(row=3, column=0, columnspan=4, sticky=tk.W)
updateButton.grid(row=3, column=5) updateButton.grid(row=3, column=5)
win.pack(expand="yes", fill="both") win.pack(expand="yes", fill="both")