RPM files md5sum

Eran Ben Natan eranb at celltick.com
Thu Mar 13 16:14:27 UTC 2014

It will work only if when running the %post the rpm is considered "installed" and can be queried with rpm -q
Another option is: At the end of the %install calculate yourself the checksum of all files (it should be simple with something like: find %{buildroot} -type f -exec mdsum {} \; ) into a file, package this file, and in the %post copy this file somewhere else so it won't be deleted when rpm is uninstalled.

Hope this helps, Eran.

From: rpm-list-bounces at lists.rpm.org [mailto:rpm-list-bounces at lists.rpm.org] On Behalf Of Dragos Diaconescu
Sent: Wednesday, March 12, 2014 4:49 PM
To: Florian Festi
Cc: rpm-list at lists.rpm.org
Subject: Re: RPM files md5sum

I know that the rpm stores the ckecksums, but for this I need to keep the rpm.
I would need to have a separate file with all these check sums and if the rpm is deleted I can check this file.
Also, I would like to create this file during the rpm installation. I am the one who builds the rpm and I can modify the
SPEC file.

I would need to add something similar to your command, but in the SPEC file, in the %post section. Is there
any way?
With kind regards,

On Wed, Mar 12, 2014 at 4:15 PM, Florian Festi <ffesti at redhat.com<mailto:ffesti at redhat.com>> wrote:
On 03/11/2014 05:11 PM, Dragos Diaconescu wrote:
> Hi,
> I would need to to save the md5sum for all of the files that exists into
> a rpm. I would need
> to store these md5sums for each file into a separate file, automatically
> after
> the rpm was installed.
> Is there any way to do this in the rpm build SPEC file, in the %post
> section?
> I would need something different than  the command "rpm -qp --dump <rpm
> file>".
> I would need these md5sums to be stored automatically after the rpm was
> installed.
I am not entirely sure what you actually want to achieve but rpm already
stores the check sums of all installed files. You can get them with e.g.

rpm -q --qf "[%{FILENAMES}\t%{FILEDIGESTS}\n]" rpm

Also rpm --verify is capable to check them against the installed files.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20140313/ed5d99de/attachment.html>

More information about the Rpm-list mailing list