[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rm -rf /usr/somedir in maintainer scripts?

Nikolaus Rath <Nikolaus@rath.org> writes:
> Tollef Fog Heen <tfheen@err.no> writes:
>> ]] Nikolaus Rath 

>>> How do I check if a directory belongs to a package?

>> dpkg -S ?

> I guess you shouldn't have used "belongs" but "owns" here. For example,
> for /usr/share/dict dpkg -S lists wamerican, base-files and
> dictionaries-common. How do I find out which of these owns this
> directory and may rm -rf it?

This is not normally a thing that you would ever do, which is why that
answer is hard to come by.  Normally, in Debian, packages own files, and
directories appear and disappear based on whether the package has to put a
file in that directory.  (Yes, the directories themselves are also
included in the package, but it's not normally a useful conceptual model
for the *intent* of the package.)  There are some cases where the package
intends to ship an empty directory, often in /var for run-time state, but
this is the exception rather than the common case, and it's particularly
uncommon in /usr.

A package that wants to change a directory to a symlink (or vice versa) is
a very special case, and one that runs afoul of dpkg support for the local
system administrator moving and symlinking directories (something that can
be quite useful if one screws up disk partitioning or runs out of disk
space in the / or /usr partition, which admittedly is getting less common
on typical servers and desktops but can still be an issue for smaller

The most accurate statement about this case is probably "this change is
not fully supported by the current Debian packaging tools."  I don't think
it's something for which we currently have easy answers.  It may require
either some design work or some case-by-case analysis.

Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

Reply to: