[TriLUG] good newbie book

Robert Wagoner RAWagoner at mactec.com
Thu Nov 29 11:22:04 EST 2001


mbroome at employees.org 11/28/01 4:25 PM
> On Wed, Nov 28, 2001 at 10:06:52AM -0700, Ed Hill wrote:
> > Lisa Lorenzin wrote:
> > > can anyone tell me how to use rpm (the command) to determine what
rpm
> > > (package) contains the library i need, when the rpms (packages)
are on the
> > > cd, rather than installed?  specifically, i want the moral
equivalent of
> > > rpm -qp --whatprovides libfoo.so.1, but when i try that, it tells
me i can
> > > only do one type of query at a time.  (sigh.)
> > 
> > 
> > for i in *.rpm
> > do
> >    n=`rpm -qlp $i | grep libfoo | wc -l`
> >    if [ $n -ne 0 ]; then
> >      echo $i
> >    fi
> > done
> 
> 
> That's pretty much sums up what I ended up writing.  Plus being able
to
> pass in a string to search for and a list of files (or a glob) to
search
> over.  Then I added some status messages so you knew it was actually
> doing something (since it takes a looong time to grub through all
the
> RPMs on a 2x CDROM on a P100).  When I started trying to build up a
list
> of filenames to display after the loop, I decided that I should have
> written it in Perl. :)  But it worked.  I *love* a programmable
shell.
> 
> But we were wondering if there is a way of doing that without
leaving
> the confines of rpm.  Or if there's a practical way of doing that
for
> people who don't write shell scripts.  It seems like the RH
installer
> (Anaconda?) does this for you when you get to the end of the install
and
> it tells about the dependencies you are missing and can
automagically
> install the needed rpms.  Anyone know if there's anyway to get that
> functionality (or get the rpm install part of the installer) after
the
> initial install?
> 
> Mike


Hi folks, here are a few things that may be useful.

1.  Install the rpmdb-redhat package.
This lets you examine all the packages on the CDs, not just the ones
you've
installed.  Afterward, you can run

rpm --dbpath /usr/lib/rpmdb/i386-redhat-linux/redhat [other options]

to query this complete list.  By contrast, the database of installed
packages
is at /var/lib/rpm, if you don't specify the dbpath.


2.  Query for capabilities and dependency relations like

rpm [ --dbpath ... ] --query --whatprovides foo
rpm [ --dbpath ... ] --query --whatrequires bar
rpm [ --dbpath ... ] --query --group 'System Environment/Daemons'
rpm [ --dbpath ... ] --query --all --filesbypkg | grep baz

and other variations as needed.  The list of package group names is at
/usr/share/doc/rpm-4.0.3/GROUPS if you need it.


3.  The installer's list of sets of packages is on the first CD, at
/RedHat/base/comps which is fairly easy to read.  So, if you decide
post-installation that you *do* want KDE after all, you can cut all
the
relevant package names, then issue

rpm -Uvh pkg1 pkg2 pkg3 ...

and go have dinner while it grinds through them all, instead of
installing
one at a time.


I hope this helps.
-- 
Robert




More information about the TriLUG mailing list