From 0fb378c613f40aa11981a6b72e82b00969b1764e Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Tue, 15 Apr 2025 19:52:37 +0800 Subject: [PATCH 1/2] chore: change pk policy from packagekit to appwiz's script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整卸载脚本的polkit规则,使得符合磐石环境的需求. PMS: BUG-303279 Log: --- dbus/launcher1compat.cpp | 2 +- polkit-1/rules.d/org.deepin.dde.application-wizard.rules | 2 +- scripts/dde-appwiz-uninstaller.sh | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dbus/launcher1compat.cpp b/dbus/launcher1compat.cpp index 111ad96..53aaeff 100644 --- a/dbus/launcher1compat.cpp +++ b/dbus/launcher1compat.cpp @@ -121,7 +121,7 @@ void Launcher1Compat::uninstallPackageByScript(const QString & pkgDisplayName, c // call `/usr/libexec/dde-appwiz-uninstaller.sh ` and check the return code. qDebug() << "Calling dde-appwiz-uninstaller.sh to uninstall" << pkgDisplayName << packageDesktopFilePath << "via script"; QProcess process; - process.start("/usr/libexec/dde-appwiz-uninstaller.sh", QStringList{packageDesktopFilePath}); + process.start("pkexec", QStringList{"/usr/libexec/dde-appwiz-uninstaller.sh", packageDesktopFilePath}); process.waitForFinished(); QString standardOutput = process.readAllStandardOutput(); diff --git a/polkit-1/rules.d/org.deepin.dde.application-wizard.rules b/polkit-1/rules.d/org.deepin.dde.application-wizard.rules index 3f4490a..5ebaab4 100644 --- a/polkit-1/rules.d/org.deepin.dde.application-wizard.rules +++ b/polkit-1/rules.d/org.deepin.dde.application-wizard.rules @@ -3,7 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later polkit.addRule(function(action, subject) { - if ((action.id == "org.freedesktop.packagekit.package-remove") && + if ((action.id == "org.deepin.dde.appwiz.uninstall") && subject.active == true && subject.local == true && subject.isInGroup("sudo")) { return polkit.Result.YES; diff --git a/scripts/dde-appwiz-uninstaller.sh b/scripts/dde-appwiz-uninstaller.sh index 9e42d89..ef00024 100755 --- a/scripts/dde-appwiz-uninstaller.sh +++ b/scripts/dde-appwiz-uninstaller.sh @@ -27,8 +27,15 @@ if [ -z "$PACKAGE_NAME" ]; then exit 1 fi +# Check if the user is root, if not, use pkexec +if [ "$EUID" -eq 0 ]; then + apt_command="apt purge -y" +else + apt_command="pkexec apt purge -y" +fi + # Use pkexec to uninstall the package -if pkexec apt purge -y "$PACKAGE_NAME"; then +if $apt_command "$PACKAGE_NAME"; then echo "Package '$PACKAGE_NAME' has been successfully uninstalled." else echo "Error: Failed to uninstall the package '$PACKAGE_NAME'." From a3c0f6b626a70716204da7ee4b420807a56850d4 Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Tue, 15 Apr 2025 20:02:13 +0800 Subject: [PATCH 2/2] chore: release dde-application-wizard 0.1.14 Changelog: * chore: change polkit rule from packagekit to appwiz's script (PMS: BUG-303279) Log: --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4455625..b1dea6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +dde-application-wizard (0.1.14) unstable; urgency=medium + + * chore: change polkit rule from packagekit to appwiz's script + (PMS: BUG-303279) + + -- Wang Zichong Thu, 15 Mar 2025 20:00:00 +0800 + dde-application-wizard (0.1.13) unstable; urgency=medium * fix: Uninstalling compatibility mode application failed