Article
RPM is a powerful tool for managing both installed packages and not installed ones. It maintains the RPM database for all the installed packages in the system, which is useful while resolving the dependencies and conflicts among the packages and getting the meta data of the installed packages.
Run RPM commands as Root. Because RPM makes changes to your system, you must be root in order to install, remove, or upgrade an RPM package.
In this article I am going to explain how to query and verify the installed RPMs.
Querying:
The 'rpm -q' command queries the database of installed packages. The 'rpm -q rpmName' command will print the package name, version and release number of installed package 'pkgName'.
# rpm -q MozillaFirefox-3.0.4-4.6
MozillaFirefox-3.0.4-4.6
Following are the Package Specification Options can be used along with the -q option.
-a ---> Query all installed packages.
-d ---> List only documentation files (implies -l).
-c --- > List only configuration files (implies -l).
-i ---> Display package information, including name, version, and description. This uses the --queryformat if one was specified.
The following example shows you the all the information related to the package MozillaFirefox.
< – Snippet start – > # rpm -qi MozillaFirefox-3.0.4-4.6 Name : MozillaFirefox Relocations: (not relocatable) Version : 3.0.4 Vendor: openSUSE Release : 4.6 Build Date: Wed Dec 3 17:24:24 2008 Install Date: Fri Dec 5 10:37:25 2008 Build Host: build22 Group : Productivity/Networking/Web/Browsers Source RPM: MozillaFirefox-3.0.4-4.6.src.rpm Size : 3373954 License: GPL v2 or later; LGPL v2.1 or later; MOZILLA PUBLIC LICENSE (MPL/NPL) Signature : RSA/8, Wed Dec 3 17:25:04 2008, Key ID b88b2fd43dbdc284 Packager : http://bugs.opensuse.org URL : http://www.mozilla.org/ Summary : Mozilla Firefox Web Browser Description : Mozilla Firefox is a standalone web browser, designed for standards compliance and performance. Its functionality can be enhanced via a plethora of extensions. Authors: -------- Mozilla Foundation <drivers@mozilla.org> Distribution: openSUSE 11.1 < – snippet end – >
-p PACKAGE_FILE ---> Query an (uninstalled) package PACKAGE_FILE. The PACKAGE_FILE may be specified as an ftp or http style URL, in which case the package header will be downloaded and queried.
-l ---> List files in package. If the -P option is also given, only patched files are shown.
The following example shows all the files installed by the package MozillaFirefox. (In fact it shows so many files but here I listed only some of them)
< – snippet start – > # # rpm -ql MozillaFirefox-3.0.4-4.6 /usr/bin/firefox /usr/lib/firefox /usr/lib/firefox/application.ini /usr/lib/firefox/blocklist.xml /usr/lib/firefox/chrome /usr/lib/firefox/chrome/browser.jar /usr/lib/firefox/chrome/browser.manifest /usr/lib/firefox/chrome/classic.jar /usr/lib/firefox/chrome/classic.manifest /usr/lib/firefox/chrome/en-US.jar /usr/lib/firefox/chrome/en-US.manifest /usr/lib/firefox/chrome/icons /usr/lib/firefox/chrome/icons/default . . . < – snippet end – >
-s ---> Display the states of files in the package (implies -l). The state of each file is one of normal, not installed, or replaced.
--provides ---> List capabilities this package provides.
< – snippet start – > # rpm -q --provides MozillaFirefox-3.0.4-4.6 web_browser firefox MozillaFirefox = 3.0.4-4.6 < – snippet end – >
-R, --requires ---> List packages on which this package depends.
--scripts ---> List the package specific scriptlet(s) that are used as part of the installation and uninstallation processes.
< – snippet start – >
#rpm -q --scripts MozillaFirefox-3.0.4-4.6
postinstall scriptlet (using /bin/sh):
# update mime and desktop database
if [ -f usr/bin/update-mime-database ] ; then
usr/bin/update-mime-database /usr/share/mime > /dev/null || :
fi
if [ -f usr/bin/update-desktop-database ] ; then
usr/bin/update-desktop-database > /dev/null || :
fi
# move plugins to new location
if [ "$1" = "2" ]; then
if [ -d /opt/MozillaFirefox/lib/plugins ]; then
rm -rf /opt/MozillaFirefox/lib/plugins/libnullplugin.so
cp -fud /opt/MozillaFirefox/lib/plugins/* /usr/lib/firefox/plugins
rm -rf /opt/MozillaFirefox/lib/plugins
fi
fi
exit 0
postuninstall scriptlet (using /bin/sh):
if [ -f usr/bin/update-mime-database ] ; then
usr/bin/update-mime-database /usr/share/mime > /dev/null || :
fi
if [ -f usr/bin/update-desktop-database ] ; then
usr/bin/update-desktop-database > /dev/null || :
fi
< – snippet end -->RPM Verify options:
The general form of an rpm verify command is:
rpm {-V|--verify} [select-options] [verify-options]Verifying a package compares information about the installed files in the package with information about the files taken from the package metadata stored in the rpm database. Among other things, verifying compares the size, MD5 sum, permissions, type, owner and group of each file.
Any discrepancies are displayed.
--nodeps Don't verify dependencies of packages.
--nodigest Don't verify package or header digests when reading.
--nofiles Don't verify any attributes of package files.
--noscripts Don't execute the %verifyscript scriptlet (if any).
--nosignature Don't verify package or header signatures when reading.
-p
This option useful if you suspect that your RPM databases are corrupt.
If everything verified properly, there will be no output. If there are any discrepancies they will be displayed. The format of the output is a string of eight characters (a c denotes a configuration file) and then the file name. Each of the eight characters denotes the result of a comparison of one attribute of the file to the value of that attribute recorded in the RPM database. A single . (a period) means the test passed.
For more information about the querying and verifying options see the man page of rpm.
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.
Related Articles
User Comments
- Be the first to comment! To leave a comment you need to Login or Register
- 3727 reads


0