From patchwork Mon Aug 16 16:45:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Whitcroft X-Patchwork-Id: 61818 X-Patchwork-Delegate: leann.ogasawara@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 0815AB6F14 for ; Tue, 17 Aug 2010 02:45:55 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1Ol2ok-0003yi-Pe; Mon, 16 Aug 2010 17:45:46 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1Ol2oj-0003xI-1q for kernel-team@lists.ubuntu.com; Mon, 16 Aug 2010 17:45:45 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1Ol2oi-0007ZY-TL for ; Mon, 16 Aug 2010 17:45:45 +0100 Received: from [85.210.151.50] (helo=localhost.localdomain) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Ol2oi-0001hj-Mi for kernel-team@lists.ubuntu.com; Mon, 16 Aug 2010 17:45:44 +0100 From: Andy Whitcroft To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] [Maverick] [V2] UBUNTU: debian -- more agressivly clean up after depmod on purge Date: Mon, 16 Aug 2010 17:45:43 +0100 Message-Id: <1281977143-29205-1-git-send-email-apw@canonical.com> X-Mailer: git-send-email 1.7.0.4 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com BugLink: http://bugs.launchpad.net/bugs/618591 During install we execute depmod to ensure we have the appropriate module supper indexes for the installed system, we are however required to clean up after it on uninstall. As depmod is provided by an external package changes in that package can lead to the kernel leaking files on uninstall, preventing a successful purge. Though we cannot know what files depmod does generate they (so far) all are prefixed with "modules." in /lib/modules//. The kernel binary packages do intentionally include two files with this prefix (modules.builtin and modules.order). As we know exactly which files we are carrying move to removing all other modules.* files when uninstalling to ensure we cleanup comprehensivly behind depmod. Also adds linkage between the two places where these files are now listed to ensure we keep them in lock-step. This should ensure that should new files be added to depmod's output set we should purge them automatically. Signed-off-by: Andy Whitcroft Acked-by: Tim Gardner --- debian/control-scripts/prerm | 23 ++++++++++------------- debian/rules.d/2-binary-arch.mk | 2 ++ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/debian/control-scripts/prerm b/debian/control-scripts/prerm index ae248dd..c214842 100644 --- a/debian/control-scripts/prerm +++ b/debian/control-scripts/prerm @@ -278,19 +278,16 @@ if (-d "/etc/kernel/prerm.d/$version") { } sub success () { - my @files_to_remove = qw{ - modules.dep modules.isapnpmap modules.pcimap - modules.usbmap modules.parportmap - modules.generic_string modules.ieee1394map - modules.ieee1394map modules.pnpbiosmap - modules.alias modules.ccwmap modules.inputmap - modules.symbols modules.ofmap modules.seriomap - modules.alias.bin modules.builtin.bin modules.dep.bin modules.symbols.bin - }; - - foreach my $extra_file (@files_to_remove) { - if (-f "/lib/modules/$version/$extra_file") { - unlink "/lib/modules/$version/$extra_file"; + # NOTE: need to keep this list in sync with rules.d/2-binary-arch.mk + my %files_to_keep = ( + 'modules.builtin' => 1, + 'modules.order' => 1, + ); + my $short; + for my $file () { + $short = $file; $short =~ s,.*/,,; + if (!defined $files_to_keep{$short}) { + unlink "$file"; } } exit 0; diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index 6777b5e..16656c0 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -201,6 +201,8 @@ endif # # Remove files which are generated at installation by postinst, # except for modules.order and modules.builtin + # + # NOTE: need to keep this list in sync with postrm # mkdir $(pkgdir)/lib/modules/$(abi_release)-$*/_ mv $(pkgdir)/lib/modules/$(abi_release)-$*/modules.order \