From 4669c756c4b7605eed7c6c6c22e0f5028f796a58 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Sun, 14 Jan 2024 22:25:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=93=E5=8C=85=E5=99=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=20deb=20=E5=8C=85=E5=9C=A8=E9=9D=9E?= =?UTF-8?q?=20Deepin=20=E7=B3=BB=E7=BB=9F=E6=97=A0=E6=B3=95=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E5=9C=A8=E5=90=AF=E5=8A=A8=E5=99=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E6=96=B9=E5=BC=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deepin-wine-easy-packager.py | 2 ++ deepin-wine-packager.py | 9 +++++++-- package-script/script-packager.sh | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/deepin-wine-easy-packager.py b/deepin-wine-easy-packager.py index 01418cb..a6e1f3d 100755 --- a/deepin-wine-easy-packager.py +++ b/deepin-wine-easy-packager.py @@ -566,6 +566,7 @@ class RunThread(QtCore.QThread): debDesktop = ReplaceText(desktopFile, replaceMap) ########### 写入文件 WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/entries/applications/{debPackageName}.desktop", debDesktop) + WriteTxt(f"{debBuildPath}/opt/usr/share/applications/{debPackageName}.desktop", debDesktop) WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/files/run.sh", debRunSh) WriteTxt(f"{debBuildPath}/opt/apps/{debPackageName}/info", debInfo) WriteTxt(f"{debBuildPath}/DEBIAN/control", debControl) @@ -575,6 +576,7 @@ class RunThread(QtCore.QThread): self.RunCommand(f"chmod -Rv 0755 '{debBuildPath}/DEBIAN'") self.RunCommand(f"chmod -Rv 755 '{debBuildPath}/opt/apps/{debPackageName}/files/'*.sh") self.RunCommand(f"chmod -Rv 755 '{debBuildPath}/opt/apps/{debPackageName}/entries/applications/'*.desktop") + self.RunCommand(f"chmod -Rv 755 '{debBuildPath}/usr/share/applications/'*.desktop") ########### 打包 deb print(debPackageVersion) self.RunCommand(f"dpkg-deb -Z xz -b '{debBuildPath}' '{desktopPath}/{debPackageName}_{debPackageVersion}_all.deb'") diff --git a/deepin-wine-packager.py b/deepin-wine-packager.py index 92b48d6..766e177 100755 --- a/deepin-wine-packager.py +++ b/deepin-wine-packager.py @@ -1384,6 +1384,7 @@ fi if debArch.currentIndex() != 2: # Deepin Wine 包目录结构 os.makedirs("{}/opt/apps/{}/entries/applications".format(debPackagePath, e1_text.text())) + os.makedirs("{}/usr/share/applications".format(debPackagePath)) os.makedirs("{}/opt/apps/{}/entries/icons/hicolor/scalable/apps".format(debPackagePath, e1_text.text())) os.makedirs("{}/opt/apps/{}/files".format(debPackagePath, e1_text.text())) else: @@ -1519,6 +1520,7 @@ Description: {e3_text.text()} ] line = "\\" if desktopIconTab.count() <= 1 and debArch.currentIndex() != 2: + write_txt("{}/usr/share/applications/{}.desktop".format(debPackagePath, e1_text.text()), '#!/usr/bin/env xdg-open\n[Desktop Entry]\nEncoding=UTF-8\nType=Application\nX-Created-By={}\nCategories={};\nIcon={}\nExec="/opt/apps/{}/files/run.sh" --uri {}\nName={}\nComment={}\nMimeType={}\nGenericName={}\nTerminal=false\nStartupNotify=false\n'.format(e4_text.text(), option1_text.currentText(), a, e1_text.text(), e15_text.text(), e8_text.text(), e3_text.text(), e10_text.text(), e1_text.text())) write_txt("{}/opt/apps/{}/entries/applications/{}.desktop".format(debPackagePath, e1_text.text(), e1_text.text()), '#!/usr/bin/env xdg-open\n[Desktop Entry]\nEncoding=UTF-8\nType=Application\nX-Created-By={}\nCategories={};\nIcon={}\nExec="/opt/apps/{}/files/run.sh" --uri {}\nName={}\nComment={}\nMimeType={}\nGenericName={}\nTerminal=false\nStartupNotify=false\n'.format(e4_text.text(), option1_text.currentText(), a, e1_text.text(), e15_text.text(), e8_text.text(), e3_text.text(), e10_text.text(), e1_text.text())) elif debArch.currentIndex() == 2: # 直接跳过 .desktop 文件生成 @@ -1529,7 +1531,7 @@ Description: {e3_text.text()} command = f"--uri {iconUiList[i][2].text()}" else: command = iconUiList[i][2].text() - write_txt("{}/opt/apps/{}/entries/applications/{}-{}.desktop".format(debPackagePath, e1_text.text(), e1_text.text(), os.path.splitext(os.path.basename(iconUiList[i][0].text().replace("\\", "/")))[0]), f'''#!/usr/bin/env xdg-open + desktopFile = f'''#!/usr/bin/env xdg-open [Desktop Entry] Encoding=UTF-8 Type=Application @@ -1543,7 +1545,9 @@ MimeType={iconUiList[i][5].text()} GenericName={e1_text.text()} Terminal=false StartupNotify=false -''') +''' + write_txt("{}/opt/apps/{}/entries/applications/{}-{}.desktop".format(debPackagePath, e1_text.text(), e1_text.text(), os.path.splitext(os.path.basename(iconUiList[i][0].text().replace("\\", "/")))[0]), desktopFile) + write_txt("{}/usr/share/applications/{}-{}.desktop".format(debPackagePath, e1_text.text(), os.path.splitext(os.path.basename(iconUiList[i][0].text().replace("\\", "/")))[0]), desktopFile) # 要开始分类讨论了 if debArch.currentIndex() == 0 or debArch.currentIndex() == 1 and debArch.currentIndex() != 2: if desktopIconTab.count() <= 1: @@ -1601,6 +1605,7 @@ StartupNotify=false #self.run_command("chmod -Rv 755 {}/opt/apps/{}/files/*_with_box86.sh".format(debPackagePath, e1_text.text())) #self.run_command("chmod -Rv 755 {}/opt/apps/{}/files/*_with_exagear.sh".format(debPackagePath, e1_text.text())) self.run_command("chmod -Rv 755 {}/opt/apps/{}/entries/applications/*.desktop".format(debPackagePath, e1_text.text(), e1_text.text())) + self.run_command("chmod -Rv 755 {}/usr/share/applications/*.desktop".format(debPackagePath, e1_text.text())) ################ # 构建 deb 包 ################ diff --git a/package-script/script-packager.sh b/package-script/script-packager.sh index 7c3ae70..7480d5d 100755 --- a/package-script/script-packager.sh +++ b/package-script/script-packager.sh @@ -307,7 +307,9 @@ TranslateTemplateFileUos "$outdir/info" #if no desktop_file_categories, don't create desktop if [ -n "$desktop_file_categories" ]; then mkdir -p "$outentries/applications" + mkdir -p "$dstdir/usr/share/applications" cp "$curdir/template/target.desktop" "$outentries/applications/$deb_package_name.desktop" + cp "$curdir/template/target.desktop" "$dstdir/usr/share/applications/$deb_package_name.desktop" TranslateTemplateFileUos "$outentries/applications/$deb_package_name.desktop" # TODO: We should generate icons from main program automatically.