Re: finding orphaned files

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

 




On Tue, Jul 22, 2008 at 6:03 PM, <Greg_Swift@xxxxxxxxxxxxxxxxx> wrote:


rpm-list-bounces@xxxxxxxxxx wrote on 07/21/2008 04:06:15 PM:

> Hi Greg-
>
>     First a question back at you - it seems like your first step
> replicates the --verify option to some extent. Is there some info not
> provided by --verify that you need for step 1?

programatic access.  It doesn't check all the other bits that -V does, and
also allows me to manipulate the list without the need of parsing the
output of rpm -Va.

>     About "2:" - I find when I set up the spec file for an rpm, it's
> best to only define %directory that I'm pretty sure won't already exist.
> For example, I would  define it for /opt/mypackage, but not /opt. If you
> have control over the spec files for the rpms you're talking about, you
> could trim these unneeded %directory entries to reduce the orphaned
> directories output from your script.
>
>     Also, I think you'll find that orphaned files are sometimes config
> files, which are retained if they have been edited before rpm removal.

Fortunately, I am not responsible for all of the RedHat RPMs.
Unfortunately, I'm only responsible for a handful of our own RPMs.  Even
more unfortunately, some of the modifications on the systems (additional
apps and such) aren't always added with RPM.  Its this last scenario that I
am trying to provide the enumeration for.  The question was more towards
being able to tell which way an rpm owned a directory and its contents with
only access to the RPM database.

This simple script give you which rpm own which dir.

_t_d=$(mktemp -d -p /tmp)
_f_f=$(mktemp -p ${_t_d} XXXXXXX)
for _pkg in $(rpm -qa --qf '%{name}-%{version}\n' | sort | uniq)
do
 rpm -q --qf '%{name} owns %{dirnames}\n' ${_pkg} | uniq >> ${_f_f}
done
echo "wrote ${_f_f}"

FYI, rpm5 have implicit dependency on parent dir o filelinkto (so it is no possible to have orphan dir for example: this resolve many problem on package removal or upgrade). IMHO, Orphan file aren't an issue, IMHO, if they live in /var or  in a volatile filesystem .

hth


 

-greg

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux