From 0d2e59b9fe4276fe27e9f0aee04b8ae659701755 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sat, 5 Aug 2023 08:57:55 +0800 Subject: [PATCH] =?UTF-8?q?dcm/bcm=E5=8C=85=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deepin-wine-easy-packager.py | 6 +- deepin-wine-packager.py | 10 ++-- package-script/debian/postrm | 47 ++++++++++++--- package-script/package.py | 4 +- package-script/script-packager.sh | 2 +- package-script/template/run.sh | 99 ++++++++++++++++++++++++++++++- 6 files changed, 147 insertions(+), 21 deletions(-) diff --git a/deepin-wine-easy-packager.py b/deepin-wine-easy-packager.py index b5691cb..5de2aa3 100755 --- a/deepin-wine-easy-packager.py +++ b/deepin-wine-easy-packager.py @@ -515,8 +515,8 @@ class RunThread(QtCore.QThread): # 拷贝文件到容器 self.RunCommand(f"cp -rv '{folderExePath}' '{bottlePath}/drive_c/Program Files'") debPackageVersion = self.GetEXEVersion(exePath.text(), bottlePath) - debDescription = f"{exeName} By Deepin Wine 6 Stable And Build By Wine Runner Easy Packager" - debDepends = f"{chooseWine}, spark-dwine-helper | store.spark-app.spark-dwine-helper, fonts-wqy-microhei, fonts-wqy-zenhei" + debDescription = f"{exeName} By Build By Wine Runner Easy Packager" + debDepends = f"{chooseWine} | {chooseWine}-bcm | {chooseWine}-dcm, spark-dwine-helper | store.spark-app.spark-dwine-helper, fonts-wqy-microhei, fonts-wqy-zenhei" self.RunCommand(f"mkdir -pv '{debBuildPath}/DEBIAN'") self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/files'") self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/applications'") @@ -644,7 +644,7 @@ if __name__ == "__main__": "使用 Deepin Wine2 打包应用" ] wineChooserIndex = 0 - wineList = ["spark-wine8", "spark-wine7-devel", "deepin-wine6-stable", "deepin-wine5-stable", "deepin-wine5", "deepin-wine"] + wineList = ["spark-wine7-devel", "deepin-wine6-stable", "deepin-wine5-stable", "deepin-wine5", "deepin-wine"] for i in range(len(wineList)): if not os.system(f"which '{wineList[i]}'"): wineChooserIndex = i diff --git a/deepin-wine-packager.py b/deepin-wine-packager.py index cb87baa..08e6657 100755 --- a/deepin-wine-packager.py +++ b/deepin-wine-packager.py @@ -1696,8 +1696,8 @@ def BrowserHelperConfigPathText(): def ChangeWine(): useInstallWineArch.setEnabled(os.path.exists(wine[wineVersion.currentText()])) - debDepends.setText([f"{wine[wineVersion.currentText()]}, deepin-wine-helper (>= 5.1.30-1), fonts-wqy-microhei, fonts-wqy-zenhei", - f"{wine[wineVersion.currentText()]}, spark-dwine-helper | store.spark-app.spark-dwine-helper, fonts-wqy-microhei, fonts-wqy-zenhei" + debDepends.setText([f"{wine[wineVersion.currentText()]} | {wine[wineVersion.currentText()]}-bcm | {wine[wineVersion.currentText()]}-dcm, deepin-wine-helper (>= 5.1.30-1), fonts-wqy-microhei, fonts-wqy-zenhei", + f"{wine[wineVersion.currentText()]} | {wine[wineVersion.currentText()]}-bcm | {wine[wineVersion.currentText()]}-dcm, spark-dwine-helper | store.spark-app.spark-dwine-helper, fonts-wqy-microhei, fonts-wqy-zenhei" ][int(chooseWineHelperValue.isChecked())]) debRecommend.setText("") helperConfigPathText.setEnabled(chooseWineHelperValue.isChecked()) @@ -1706,9 +1706,9 @@ def ChangeWine(): debDepends.setText(["deepin-wine-helper (>= 5.1.30-1)", "spark-dwine-helper | store.spark-app.spark-dwine-helper" ][int(chooseWineHelperValue.isChecked())]) - if "deepin-wine5-stable" in wine[wineVersion.currentText()]: - debDepends.setText("libasound2 (>= 1.0.16), libc6 (>= 2.28), libglib2.0-0 (>= 2.12.0), libgphoto2-6 (>= 2.5.10), libgphoto2-port12 (>= 2.5.10), libgstreamer-plugins-base1.0-0 (>= 1.0.0), libgstreamer1.0-0 (>= 1.4.0), liblcms2-2 (>= 2.2+git20110628), libldap-2.4-2 (>= 2.4.7), libmpg123-0 (>= 1.13.7), libopenal1 (>= 1.14), libpcap0.8 (>= 0.9.8), libpulse0 (>= 0.99.1), libudev1 (>= 183), libvkd3d1 (>= 1.0), libx11-6, libxext6, libxml2 (>= 2.9.0), ocl-icd-libopencl1 | libopencl1, udis86, zlib1g (>= 1:1.1.4), libasound2-plugins, libncurses6 | libncurses5 | libncurses, deepin-wine-plugin-virtual") - debRecommend.setText("libcapi20-3, libcups2, libdbus-1-3, libfontconfig1, libfreetype6, libglu1-mesa | libglu1, libgnutls30 | libgnutls28 | libgnutls26, libgsm1, libgssapi-krb5-2, libjpeg62-turbo | libjpeg8, libkrb5-3, libodbc1, libosmesa6, libpng16-16 | libpng12-0, libsane | libsane1, libsdl2-2.0-0, libtiff5, libv4l-0, libxcomposite1, libxcursor1, libxfixes3, libxi6, libxinerama1, libxrandr2, libxrender1, libxslt1.1, libxxf86vm1") + #if "deepin-wine5-stable" in wine[wineVersion.currentText()]: + # debDepends.setText("libasound2 (>= 1.0.16), libc6 (>= 2.28), libglib2.0-0 (>= 2.12.0), libgphoto2-6 (>= 2.5.10), libgphoto2-port12 (>= 2.5.10), libgstreamer-plugins-base1.0-0 (>= 1.0.0), libgstreamer1.0-0 (>= 1.4.0), liblcms2-2 (>= 2.2+git20110628), libldap-2.4-2 (>= 2.4.7), libmpg123-0 (>= 1.13.7), libopenal1 (>= 1.14), libpcap0.8 (>= 0.9.8), libpulse0 (>= 0.99.1), libudev1 (>= 183), libvkd3d1 (>= 1.0), libx11-6, libxext6, libxml2 (>= 2.9.0), ocl-icd-libopencl1 | libopencl1, udis86, zlib1g (>= 1:1.1.4), libasound2-plugins, libncurses6 | libncurses5 | libncurses, deepin-wine-plugin-virtual") + # debRecommend.setText("libcapi20-3, libcups2, libdbus-1-3, libfontconfig1, libfreetype6, libglu1-mesa | libglu1, libgnutls30 | libgnutls28 | libgnutls26, libgsm1, libgssapi-krb5-2, libjpeg62-turbo | libjpeg8, libkrb5-3, libodbc1, libosmesa6, libpng16-16 | libpng12-0, libsane | libsane1, libsdl2-2.0-0, libtiff5, libv4l-0, libxcomposite1, libxcursor1, libxfixes3, libxi6, libxinerama1, libxrandr2, libxrender1, libxslt1.1, libxxf86vm1") # 获取用户桌面目录 def get_desktop_path(): diff --git a/package-script/debian/postrm b/package-script/debian/postrm index c3b3f3c..899da2c 100755 --- a/package-script/debian/postrm +++ b/package-script/debian/postrm @@ -2,26 +2,57 @@ if [ "$1" = "remove" ] || [ "$1" = "purge" ];then echo "清理卸载残留" -CONTAINER_NAME="@deb_package_name@" +BOTTLE_NAME="@public_bottle_name@" #在引号中填写容器名 +PACK_NAME="@deb_package_name@" #在引号中填写软件包名 +ACTIVEX_NAME="" #activex相关,若未使用,可不设置 +MAKE_AUTOSTART="" #如果先前设置了开机自启,则在此处填写1 -if [ -z $CONTAINER_NAME ];then + + +### 以下为功能段,若只用于打包则以下内容可不看,只填写上方即可 + +make_autostart() +{ +for username in $(ls /home) + do + echo /home/$username + if [ -d "/home/$username/.config/autostart" ] + then + rm /home/$username/.config/autostart/$PACK_NAME.desktop + fi + done +} + + + +if [ -n "$MAKE_AUTOSTART" ]; then + make_autostart +fi + + +if [ -n "$ACTIVEX_NAME" ]; then + rm /usr/lib/mozilla/plugins/libpipelight-$ACTIVEX_NAME.so +fi + + +if [ -z $BOTTLE_NAME ];then echo "W: 没有指定容器,跳过清理容器。请手动前往 ~/.deepinwine/ 下删除" exit fi -if [ -e /opt/deepinwine/tools/kill.sh ];then -/opt/deepinwine/tools/kill.sh $CONTAINER_NAME -###这里注意,如果没写CONTAINER_NAME,会把QQ杀了 +if [ -e /opt/deepinwine/tools/spark_kill.sh ];then +/opt/deepinwine/tools/spark_kill.sh $BOTTLE_NAME +###这里注意,如果没写BOTTLE_NAME,会把QQ杀了 fi for username in $(ls /home) do echo /home/$username - if [ -d /home/$username/.deepinwine/$CONTAINER_NAME ] + if [ -d /home/$username/.deepinwine/$BOTTLE_NAME ] then - rm -rf /home/$username/.deepinwine/$CONTAINER_NAME + rm -rf /home/$username/.deepinwine/$BOTTLE_NAME fi done else echo "非卸载,跳过清理" -fi \ No newline at end of file +fi diff --git a/package-script/package.py b/package-script/package.py index 8dc72e4..1088c25 100755 --- a/package-script/package.py +++ b/package-script/package.py @@ -82,9 +82,9 @@ export deb_version_string="{versionName.text()}" #读取和最终解压的包名 export bottle_name="{bottonName.text()}" -export package_depends="deepin-wine6-stable:amd64 (>= 6.0.0.12-1), spark-dwine-helper | store.spark-app.spark-dwine-helper" +export package_depends="deepin-wine6-stable | deepin-wine6-stable-bcm | deepin-wine6-stable-dcm, spark-dwine-helper | store.spark-app.spark-dwine-helper" export apprun_cmd="deepin-wine6-stable" -#export package_depends="deepin-wine5-stable:amd64 (>= 5.0.29-1), spark-dwine-helper | store.spark-app.spark-dwine-helper" +#export package_depends="deepin-wine5-stable | deepin-wine5-stable-bcm | deepin-wine5-stable-dcm, spark-dwine-helper | store.spark-app.spark-dwine-helper" #export apprun_cmd="deepin-wine5-stable" # rm -fr final.dir/ diff --git a/package-script/script-packager.sh b/package-script/script-packager.sh index f27a12e..b4f4a0e 100755 --- a/package-script/script-packager.sh +++ b/package-script/script-packager.sh @@ -2,7 +2,7 @@ #export elephant_deb_package_name="" run_sh_dir="" elephant_run_sh_dir="" -start_shell="/opt/deepinwine/tools/run_v4.sh" +start_shell="/opt/deepinwine/tools/spark_run_v4.sh" if [[ -n "$SPECIFY_SHELL_PATH" ]] && [[ "$SPECIFY_SHELL_PATH" == "/opt/apps"* ]];then start_shell="$SPECIFY_SHELL_PATH" fi diff --git a/package-script/template/run.sh b/package-script/template/run.sh index 3bc3cb0..6c150c3 100755 --- a/package-script/template/run.sh +++ b/package-script/template/run.sh @@ -4,18 +4,113 @@ # # Author: Li LongYu <lilongyu@linuxdeepin.com> # Peng Hao <penghao@linuxdeepin.com> +# +# +# Copyright (C) 2022 The Spark Project +# +# +# Modifier shenmo <shenmo@spark-app.store> +# +# +# +#######################函数段。下文调用的额外功能会在此处声明 + +Get_Dist_Name() +{ + if grep -Eqii "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then + DISTRO='Deepin' + elif grep -Eqi "UnionTech" /etc/issue || grep -Eq "UnionTech" /etc/*-release; then + DISTRO='UniontechOS' + elif grep -Eqi "UOS" /etc/issue || grep -Eq "UOS" /etc/*-release; then + DISTRO='UniontechOS' + else + DISTRO='OtherOS' + fi +} + + +####获得发行版名称 + +#########################预设值段 + +version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; } +####用于比较版本?未实装 BOTTLENAME="@public_bottle_name@" APPVER="@deb_version_string@" EXEC_PATH="@exec_path@" +##### 软件在wine中的启动路径 START_SHELL_PATH="@start_shell_path@" +ENABLE_DOT_NET="" +####若使用spark-wine时需要用到.net,则请把ENABLE_DOT_NET设为true,同时在依赖中写spark-wine7-mono export MIME_TYPE="@mime_type@" + export DEB_PACKAGE_NAME="@deb_package_name@" +####这里写包名才能在启动的时候正确找到files.7z,似乎也和杀残留进程有关 export APPRUN_CMD="@apprun_cmd@" -export PATCH_LOADER_ENV="@patch_loader@" +#####wine启动指令,建议 +#EXPORT_ENVS="wine的动态链接库路径" +##例如我的wine应用是使用的dwine6的32位容器,那么我要填LD_LIBRARY_PATH=$LD_LIBRARY;/opt/deepin-wine6-stable/lib +## 如果用不到就不填,不要删除前面的注释用的# + +export SPECIFY_SHELL_DIR=`dirname $START_SHELL_PATH` + +ARCHIVE_FILE_DIR="/opt/apps/$DEB_PACKAGE_NAME/files" + +export WINEDLLPATH=/opt/$APPRUN_CMD/lib:/opt/$APPRUN_CMD/lib64 + +export WINEPREDLL="$ARCHIVE_FILE_DIR/dlls" + +DISABLE_ATTACH_FILE_DIALOG="" +##默认为空。若为1,则不使用系统自带的文件选择,而是使用wine的 +##对于deepin/UOS,大部分的应用都不需要使用wine的,如果有需求(比如wine应用选择的限定种类文件系统的文管不支持) +##请填1。 +##注意:因为非DDE的环境不确定,所以默认会在非Deepin/UOS发行版上禁用这个功能。如果你确认在适配的发行版上可以正常启动,请注释或者删除下面这段 + +##############<<<<<<<<<禁用文件选择工具开始 +Get_Dist_Name +#此功能实现参见开头函数段 +if [ "$DISTRO" != "Deepin" ] && [ "$DISTRO" != "UniontechOS" ];then +DISABLE_ATTACH_FILE_DIALOG="1" +echo "非deepin/UOS,默认关闭系统自带的文件选择工具,使用Wine的" +echo "如果你想改变这个行为,请到/opt/apps/$DEB_PACKAGE_NAME/files/$0处修改" +echo "To打包者:如果你要打开自带请注意在适配的发行版上进行测试" +echo "To用户:打包者没有打开这个功能,这证明启用这个功能可能造成运行问题。如果你要修改这个行为,请确保你有一定的动手能力" +fi +##############>>>>>>>>>禁用文件选择工具结束 + +##############<<<<<<<<<屏蔽mono和gecko安装器开始 +##默认屏蔽mono和gecko安装器 +if [ "$APPRUN_CMD" = "spark-wine7-devel" ] || [ "$APPRUN_CMD" = "spark-wine" ]|| [ "$APPRUN_CMD" = "spark-wine8" ] && [ -z "$ENABLE_DOT_NET" ];then + +export WINEDLLOVERRIDES="mscoree=d,mshtml=d" +export WINEDLLOVERRIDES="control.exe=d" +#### "为了降低打包体积,默认关闭gecko和momo,如有需要,注释此行(仅对spark-wine7-devel有效)" + +fi +##############>>>>>>>>>屏蔽mono和gecko安装器结束 + +#########################执行段 + + + + +if [ -z "$DISABLE_ATTACH_FILE_DIALOG" ];then + export ATTACH_FILE_DIALOG=1 +fi + +if [ -n "$EXPORT_ENVS" ];then + export $EXPORT_ENVS +fi if [ -n "$EXEC_PATH" ];then - $START_SHELL_PATH $BOTTLENAME $APPVER "$EXEC_PATH" "$@" + if [ -z "${EXEC_PATH##*.lnk*}" ];then + $START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@" + else + $START_SHELL_PATH $BOTTLENAME $APPVER "C:/windows/command/start.exe" "/Unix" "$EXEC_PATH" "$@" + fi else $START_SHELL_PATH $BOTTLENAME $APPVER "uninstaller.exe" "$@" fi + +