Aaron Hanson
Aaron Hanson

Reputation: 156

quick RPM database test for changes

I'm looking at an RPM database. It is composed of the usual set of db4 files;

Basenames Dirnames Filedigests Group Installtid Name Packages Providename Provideversion Pubkeys Requirename Requireversion Sha1header Sigmd5 Triggername

I am looking for a quick way to mark the current state of the db; I would like to come back at an arbitrary later time and know if any system-changing rpm transactions have occurred.

For example; perhaps any/all system-modifying transactions would include a change to the 'Packages' file. If so, I could simply use an md5sum of that file as my 'mark';

[root@host] rpm # cat Packages |md5sum 7c23740eec936870c0ad16f8190a0088 -

Thoughts?

Upvotes: 0

Views: 96

Answers (1)

Jeff Johnson
Jeff Johnson

Reputation: 2390

The solution depends on what you are trying to accomplish, particularly if attempting snapshots or rollbacks. You seem to want only detection of changed state.

The secondary indexes are regenerated from Packages with --rebuilddb.

A digest of Packages will also change with --rebuilddb.

You are likely better off examining/saving rpm -qa --last output and perhaps using a digest like rpm -qa --last | md5sum if you wish the digest to be invariant to --rebuilddb events.

Upvotes: 1

Related Questions