Package: fai
Version: 3.4.1
Severity: minor

"PACKAGES remove" works as expected as long as the mirror knows about all the 
packages listed after that command. But if the mirror does not include one of 
these packages (which makes sense because you don't want to install them), you 
get the error "E: Couldn't find package <package>". The problem is, that 
apt-get in this case won't uninstall any other package either, even if the 
mirror knows about these packages. This is especially a problem on CD-installs 
where you usually don't have a complete mirror.

The attached patch adds a command "aptitude-remove" (similar to "remove") which 
uses aptitude instead of apt-get. aptitude handles unknown packages as expected 
(uninstall known packages, warn about unknown packages).
#! /bin/sh /usr/share/dpatch/dpatch-run
## 30_aptitude-remove.dpatch by Thilo Uttendorfer <[email protected]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad fai-3.4.1.cb1.2~/bin/install_packages fai-3.4.1.cb1.2/bin/install_packages
--- fai-3.4.1.cb1.2~/bin/install_packages	2011-06-29 16:47:00.000000000 +0200
+++ fai-3.4.1.cb1.2/bin/install_packages	2011-06-29 16:48:21.000000000 +0200
@@ -68,7 +68,7 @@
 
 
 # @commands is the order of the commands that are executed
-our @commands = qw/y2i y2r zypper zypper-rm yast rpmr urpmi urpme yumgroup yumi yumr smarti smartr hold taskrm taskinst clean-internal aptitude aptitude-r install unpack remove dselect-upgrade/;
+our @commands = qw/y2i y2r zypper zypper-rm yast rpmr urpmi urpme yumgroup yumi yumr smarti smartr hold taskrm taskinst clean-internal aptitude aptitude-r install unpack remove aptitude-remove dselect-upgrade/;
 %command = (
           "install" => "apt-get $aptopt --fix-missing install",
     "inst-internal" => "apt-get $aptopt --fix-missing -s install",
@@ -80,6 +80,7 @@
    "clean-internal" => "apt-get clean",
          "aptitude" => "aptitude -R $aptopt install",
        "aptitude-r" => "aptitude -r $aptopt install",
+  "aptitude-remove" => "aptitude $aptopt remove",
            "unpack" => "cd $downloaddir; aptitude download",
   "unpack-internal" => "dpkg --unpack --recursive $downloaddir; rm $downloaddir/*.deb",
  "pending-internal" => "dpkg --configure --pending",
@@ -138,7 +139,7 @@
 }
 
 # check if any Debian related commands/types are used in package_config
-my @debiantypes= qw/taskinst aptitude aptitude-r install remove dselect-upgrade smarti/;
+my @debiantypes= qw/taskinst aptitude aptitude-r aptitude-remove install remove dselect-upgrade smarti/;
 foreach my $dt (@debiantypes) {
   $types{$dt} and $hasdebian=1;
 }

Reply via email to