From 5af6c59b05e8fb105bbdca3b20dafaf0e1a6e1dd Mon Sep 17 00:00:00 2001 From: gm10 <13855078+gm10@users.noreply.github.com> Date: Wed, 27 Feb 2019 18:59:32 +0100 Subject: [PATCH] Fix "Purge residual configuration" button, was effectively autoremoving --- usr/lib/linuxmint/mintSources/mintSources.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/usr/lib/linuxmint/mintSources/mintSources.py b/usr/lib/linuxmint/mintSources/mintSources.py index 8bdc3ad7..ba20aeb7 100755 --- a/usr/lib/linuxmint/mintSources/mintSources.py +++ b/usr/lib/linuxmint/mintSources/mintSources.py @@ -1039,7 +1039,14 @@ def downgrade_foreign(self, widget): os.system("/usr/lib/linuxmint/mintSources/foreign_packages.py downgrade &") def fix_purge(self, widget): - os.system("aptitude purge ~c -y") + output = subprocess.run("dpkg -l | grep '^rc' | awk '{print $2}'", + stdout=subprocess.PIPE, shell=True).stdout.decode().split("\n") + if output == ['']: + print("No residual configuration found") + else: + command = ["/usr/bin/apt-get", "purge", "-y"] + command.extend(output) + subprocess.run(command) image = Gtk.Image() image.set_from_icon_name("preferences-other-symbolic", Gtk.IconSize.DIALOG) self.show_confirmation_dialog(self._main_window, _("There is no more residual configuration on the system."), image, affirmation=True)