Can a .deb package remove other packages

aptdebpackage-management

I'm trying to make a lightweight VM based on Xubuntu. I want to start with a stock Xubuntu installation and then remove any packages that I don't need.

My concept is to build a .deb package that removes the unneeded packages. I've been reasonably successful specifying that my package conflicts with the ones I want to remove. For example:

Conflicts: gnumeric, thunderbird, blueman, mousepad, xchat, etc...

This causes the named packages to be removed when my package is installed.

The problem comes later: if I want to re-install, say, Thunderbird, doing so will cause my package to be uninstalled.

What's a good way to clean up the system in an automated manner? Can the postinst script be used to remove packages?

Best Answer

How about splitting your package into two: one part that contains the real functionality, and another part that conflicts with the packages you want to remove. Make the first package recommend the second package so that it gets installed by default, but if you later want to install something that your package conflicts with, then you can choose to remove your second package. That shouldn't be a problem as the cleanup has already taken place.

Related Question