Edition 0
Copyright © 2005,2011 Fedora Project Contributors
rpmbuildpkgadd) unpacks the archive, copies the files into their final destinations based on the enclosed listing, and sets permissions and ownerships on the files as specified by the listing. Finally, this pkgadd command registers the list of freshly installed files into a system-wide database of installed files.
deep-package. deep-package was intended to be a complete reimplementation of the Solaris pkgadd utility and its helpers. Like the Solaris pkgadd software, deep-package paid no attention to half of the question of how to manage software, focusing entirely on software installation and tracking issues while entirely ignoring the initial compilation of the software.
grep, awk, and sed; an editor, such as vi; a shell, such as the Bourne-Again bash shell; and so forth) to complete the various tasks for which they typically employ Linux.
pms) software that was used with it for installation and uninstallation of all software on an application-by-application basis. Shortly thereafter, in the summer of 1994, the first public betas of Red Hat Commercial Linux were released. Red Hat initially used Red Hat Software Program Packages (RPP) as the basis of its Linux distribution. Like pms, RPP was a system-management tool that allowed for easy installation and uninstallation of applications. In late 1993, Ian Murdock founded the Debian Gnu/Linux distribution. He began seriously developing its dpkg application-management software by the summer of 1994. Like pms and RPP, dpkg made it possible to manage each application on the system.
pms software. Developers at Red Hat, particularly Marc Ewing and Erik Troan, set out to develop what they initially called the Red Hat Package Manager (RPM). Based on experiences with earlier Linux packaging software and knowledge about packaging tools used on other platforms, Red Hat had several design goals in mind when they developed RPM. These design points include the following features:
rpm -U software_package), while manual software installation using older manual methods typically requires at least six steps to complete the same task:
tar zxf software_package
cd software_package
./configure
make
su
make install
rpm -e software_package); manual removal of an installed application requires that each file associated with that application be manually deleted.
/etc/httpd/conf/httpd.conf. Suppose Apache has been installed using RPM and that you have then customized httpd.conf to specify its configuration. If you upgrade Apache using RPM, as part of the upgrade procedure, the RPM application will take precautions to preserve the customizations you have made to the Apache configuration. In contrast, manual upgrades of applications often overwrite any existing configuration files, losing all site customizations the system administrator has made.
EventLog (the Windows application that records system events, much like the Linux syslogd and klogd software) to be present. Since Windows is managed on a system level, not a package level, this dependency is guaranteed to be satisfied. On Linux systems using RPM, however, the situation is different. On Linux, for example, the Postfix application requires the syslogd application, which records system events. However, RPM provides the flexibility to install some applications but not install others or to uninstall others later. When you install Postfix, you have no guarantee that syslogd is already installed. If syslogd is not installed, Postfix will not work correctly.
syslogd installed generates a warning that syslogd must also be installed. Similarly, attempting to uninstall syslogd from a system that already has Postfix installed generates a warning that installed applications require the software that is being deleted. These warnings can be overridden if necessary, but by default RPM enforces these dependencies (refusing, for example, to let you uninstall syslogd without also uninstalling applications that require it, such as Postfix), preventing you from accidentally breaking applications by inadvertently uninstalling other software that they require to operate.
pms packaging system introduced the use of pristine source code to prepare packages. With Red Hat's early RPP package system and other similar early efforts, software packagers would compile software manually, then run commands to produce a package of that compiled software. Any changes made to the application's original source code were not recorded and would have to be recreated by the next person to package that software. Furthermore, end users wanting to know what changes had been made to the software they were running had no method of accessing that information.
kernel-smp-2.6.32.9-3.i686.rpm
kernel-smp-2.6.32.9-3.x86_64.rpm
kernel-smp-2.6.32.9-3.ppc.rpm
rootfiles-7.2-1.noarch.rpm
name-version-release.architecture.rpm
kernel-smp can be installed to provide a very important application, the SMP (symmetric multiprocessing, meaning it supports systems with more than one CPU in them) version of the Linux kernel, on the system. Sometimes, rather than an application, the software is a collection of other files needed on the system. The rootfiles package, for example, is not an application but is a collection of basic environmental configuration files for the root user's account (such as /root/.bashrc, the root user's Bash configuration file) that provides a usable, preconfigured working environment for the root user.
kernel-smp-2.6.32.9 indicates the RPM holds the 2.6.32.9 release of the SMP version of the Linux kernel, and rootfiles-7.2 is the 7.2 release of the rootfiles configuration files.
rootfiles-7.2-1 package shows this is the first release of the 7.2 version of the rootfiles software. The packager of rootfiles version 7.2 got everything right on the first try and had no need to prepare more than one release. The –3 in the kernel-smp-2.6.32.9-3 package, on the other hand, is the third release of the 2.6.32.9 version of the SMP-capable Linux kernel. This release incorporates new patches to fix bugs present in older releases of the 2.6.32.9 version of the Linux SMP kernel. The software packager increased the release number so that end users could distinguish the more recent, bug-fixed package file from the older, less bug-free package file.
kernel-smp-2.6.32.9-3.x86_64 package is intended for use on machines with a 64-bit CPU, and kernel-smp-2.6.32-9-3.i686 is intended for use on machines with an i686 (Pentium-class) CPU or better. An architecture name of noarch indicates this is a special architecture such that the files in the package work on any architecture. Typically, this is because the files are all interpreted scripts, not binary executables, or are documentation.
|
Platform
|
Architectures
|
|
Intel-compatible 32-bit
|
i386, i486, i586, i686, athlon, geode, pentium3, pentium4
|
|
Intel-compatible 64-bit
|
x86_64, amd64
|
|
Intel Itanium
|
ia64
|
|
HPAlpha (formerly Digital, Compaq)
|
alpha, alphaev5, alphaev56, alphapca56, alphaev6, alphaev67
|
|
Sparc/Ultra Sparc (Sun)
|
sparc, sparcv8, sparcv9, sparc64, sparc64v, sun4, sun4c, sun4d, sun4m, sun4u,
|
|
ARM
|
armv3l, armv4b, armv4l, armv5tel, armv5tejl, armv6l,armv7l
|
|
MIPS
|
mips, mipsel
|
|
Power PC
|
ppc, ppciseries, ppcpseries, ppc64, ppc8260, ppc8560, ppc32dy4
|
|
Motorola 68000 series
|
m68k, m68kmint, atarist, atariste, ataritt, falcon, atariclone, milan, hades
|
|
SGI MIPS
|
Sgi
|
|
IBM RS6000
|
rs6000
|
|
IBM S/390
|
i370, s390x, s390
|
|
Platform independent
|
noarch
|
kernel-source is a valid software name. Finally, keep in mind that all RPM package files use an .rpm file-name extension to denote that they are RPMs.
name-version-release. Once installed, packages are referred to without the architecture field and the .rpm extension. Furthermore, installed packages consist of lots of files, not a single RPM file. For example, the package file kernel-smp-2.6.32.9-3.i686.rpm after installation is referred to as kernel-smp-2.6.32.9-3. To simplify usage even further, installed packages can be referred to by their name field only, so this file would become simply kernel-smp.
rpm –q command to query for all installed versions of the given package, kernel.
kernel software, I have to use the full package name (such as kernel-2.6.32.11-99) whenever I want to work with my installed kernel packages.
mlocate package:
mlocate-0.22.2-2.i686.rpm
mlocate package, version 0.22.2, second build of an RPM package, for i686 (Intel) architecture systems.
gzip format.
cpio format, which is how the rpm2cpio command (introduced in the "Other RPM commands" section later in this chapter) can do its work.
mlocate package, mentioned previously, contains the mlocate application used to search for files on the system. The source code used to create this application is stored in an mlocate source RPM, for example:
mlocate-0.22.2-2.src.rpm
/var/lib/rpm/, and should contain files like the following:
Basenames
Conflictname
__db.001
__db.002
__db.003
Dirnames
Filemd5s
Group
Installtid
Name
Packages
Providename
Provideversion
Pubkeys
Requirename
Requireversion
Sha1header
Sigmd5
Triggername
__db.001 and similar files are lock files used by the RPM system. The other files are databases in Berkeley DB format. The most important file is Packages. The Packages file contains the header tag information for each package indexed by an index number for each package. This number slowly grows with time.
Name, Providename, and Group, exist to speed access to particular types of information. Treat your RPM database with care. Back up the files, especially after upgrading, installing, or removing packages.
Packages file is essential. You can recreate the rest of the files using the rpm --rebuilddb command, introduced in Chapter 4, Using the RPM Database.
rpm. One of the original goals of the RPM system is providing ease of use. In support of this goal, just about everything you want to do with the RPM system can be done with this one command. For most usage, the command-line parameters to the rpm command determine the actions it should take.
rpm commandrpm command performs the most common package-management functions, along with a host of uncommon functions as well. The table below lists the main operations you can perform with the rpm command and the command-line options to specify the given operations.
rpm operations| Operation | Short Option | Long Option |
|---|---|---|
| Upgrade/install | -U | --upgrade |
| Install | -I | --install |
| Remove | -e | --erase |
| Query | -q | --query |
| Verify | -V | --verify |
| Check signature | -K | --checksig |
| Freshen (upgrade) already-installed package | -F | --freshen |
| Initialize database | None | --initdb |
| Rebuild database | None | --rebuilddb |
rpm command. To install or upgrade a package, use the -U command-line option:
rpm -U filename.rpmmlocate RPM used as an example in this chapter, run the following command:
rpm -U mlocate-0.22.2-2.i686.rpm-h and -v options in conjunction with the –U option:
rpm -Uhv mlocate-0.22.2-2.i686.rpm–h option, the rpm command will print a series of hash marks, #, to provide feedback that the command is still running. With the –v option, the rpm command provides more verbose messages.
rpm -Uhv package_file.rpm–e command-line option:
rpm –e package_name
rpm –qa
rpm –qa | morerpm Optionsrpm command.
rpm, the RPM system includes a few more commands, including rpmbuild and rpm2cpio.
rpmbuild command helps build RPM packages. Its usage is discussed in depth in Part II of this book.
rpm2cpio command exports an RPM package file into the format that the cpio command expects. The cpio command works with many tape-backup packages. You can also take advantage of the fact that cpio can list the individual files in a cpio archive or extract files. To list the files in an RPM package, use a command like the following:
rpm2cpio package_file.rpm | cpio –tmlocate package:
rpm2cpio mlocate-0.22.2-2.i686.rpm | cpio –t
./etc/cron.daily/mlocate.cron ./etc/updatedb.conf ./usr/bin/locate ./usr/bin/updatedb ./usr/share/doc/mlocate-0.22.2 ./usr/share/doc/mlocate-0.22.2/AUTHORS ./usr/share/doc/mlocate-0.22.2/COPYING ./usr/share/doc/mlocate-0.22.2/NEWS ./usr/share/doc/mlocate-0.22.2/README ./usr/share/locale/bg/LC_MESSAGES/mlocate.mo ./usr/share/locale/ca/LC_MESSAGES/mlocate.mo ./usr/share/locale/cs/LC_MESSAGES/mlocate.mo ./usr/share/locale/da/LC_MESSAGES/mlocate.mo ./usr/share/locale/de/LC_MESSAGES/mlocate.mo ./usr/share/locale/es/LC_MESSAGES/mlocate.mo ./usr/share/locale/fr/LC_MESSAGES/mlocate.mo ./usr/share/locale/hu/LC_MESSAGES/mlocate.mo ./usr/share/locale/it/LC_MESSAGES/mlocate.mo ./usr/share/locale/ja/LC_MESSAGES/mlocate.mo ./usr/share/locale/ms/LC_MESSAGES/mlocate.mo ./usr/share/locale/nl/LC_MESSAGES/mlocate.mo ./usr/share/locale/pl/LC_MESSAGES/mlocate.mo ./usr/share/locale/pt/LC_MESSAGES/mlocate.mo ./usr/share/locale/pt_BR/LC_MESSAGES/mlocate.mo ./usr/share/locale/sr/LC_MESSAGES/mlocate.mo ./usr/share/locale/sr@latin/LC_MESSAGES/mlocate.mo ./usr/share/locale/sv/LC_MESSAGES/mlocate.mo ./usr/share/locale/zh_CN/LC_MESSAGES/mlocate.mo ./usr/share/man/man1/locate.1.gz ./usr/share/man/man5/mlocate.db.5.gz ./usr/share/man/man5/updatedb.conf.5.gz ./usr/share/man/man8/updatedb.8.gz ./var/lib/mlocate 555 blocks rpm2cpio command can also help if you want to extract a single file from the RPM package, using the cpio –ivd command-line options, as follows:
rpm2cpio mlocate-0.22.2-2.i686.rpm | cpio –ivd usr/share/doc/mlocate-0.22.2/READMEusr/share/doc/mlocate-0.22.2/README subdirectories and the README file located under usr/share/doc/mlocate-0.22.2.
–i option tells cpio to extract files. The –d option tells cpio to make any local subdirectories as needed (usr/share/doc/mlocate-0.22.2, in this example), and the –v option asks cpio to politely output verbose messages about what it does. Of course, verbose is in the eye of the beholder; with many Unix and Linux commands, verbose output is still somewhat terse.
rpm options you can use to get information and feedback on installation, for example.
rpm Commandrpm command. As a nice added benefit, just about everything you do with RPM requires a single invocation of the rpm command. That means common tasks such as installing and removing software can be done quickly and efficiently. The basics of the rpm command are not very hard, and you can perform the basic tasks within a few minutes of reading this chapter.
rpm. Of course, this isn’t required, but just about every RPM package is stored in a file with a rpm extension. For example, the following file holds an RPM package, ready to be installed:
jikes-1.16-1.i386.rpm
jikes (a Java language compiler application). From the discussion in the last two chapters, you should be able to determine the version of the program this RPM holds and which release of the RPM package this represents.
jikes-1.16-1.src.rpm
src in the package name is short for source. This file-naming convention is not required, but is used by just about all source code packages. (Following conventions helps other administrators know what to expect.)
rpmbuild for information on building RPMs from source RPMs.
rpm command provides three main operations for upgrading and installing packages:
rpm commandrpm command with the –U option, short for upgrade, as introduced in Chapter 2, RPM Overview . The basic syntax is:
rpm -U package_name
rpm –U jikes-1.16-1.i386.rpm
--upgrade long option in place of -U.
rpm command, covered shortly, present positive feedback that the package has been installed.
rpm command may print out warnings, such as the one following:
warning: pyxf86config-0.3.1-2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 897da07arpmbuild covers signing packages. In most cases, warnings such as this one are not that serious. Errors, though, should be treated seriously.
root Permissionsroot, or super user, permissions. That’s because most Linux application RPMs hold files that must be installed in a protected directory such as /usr/bin/. In addition, RPM requires root access to modify the RPM database. Even if you could modify the system directories like /usr/bin/, you must also be able to modify the RPM database to successfully install or remove packages.
rpm –q command to quickly verify a package has been installed. To verify, you need to use the name of the installed package, not the name of the RPM file. You can also use a partial package name, such as jikes in this case. For example:
rpm –q jikes
jikes-1.16-1jikes-1.16-1 has been installed. This package name corresponds to the RPM file used in the preceding installation example.
rpm -q command just asks the RPM database if the package has been installed. There may be other issues with the package that this command won’t show. For now, though, the rpm –q command verifies that package has been installed.
package jikes is not installed-h option to the rpm command prints out # signs, also called hash marks (hence the -h). These hash marks provide some confirmation that the rpm command is still running. This is important, since large packages may take a long time to install or upgrade. Run this command like the following:
rpm -Uh jikes-1.16-1.i386.rpm
########################################### [100%] ########################################### [100%]
########################################### [100%] warning: user cabbey does not exist - using root warning: user cabbey does not exist - using root warning: user cabbey does not exist - using root ########################################### [100%]rpm command won't complain. The upgrade operation, though, will remove all other versions of a package. This is one more reason to use the –U upgrade option.
rpm command. The -v option to the rpm command tells the command to print out verbose information as the command runs. Remember, though, that verbose is used in the traditional Unix and Linux meaning, which is normally not all that verbose. In the Unix/Linux context, verbose usually means slightly more than nothing. The syntax for the command follows:
rpm -Uhv jikes-1.16-1.i386.rpm-v command-line option, you will see output more like the following:
Preparing... ########################################### [100%] 1:jikes ########################################### [100%]rpm -Uhv package_file.rpm. That is, upgrade with verbose output and hashes.
-vv command-line option. Think of this as doubly verbose. Usually, though, this extra information has no meaning unless you are debugging an RPM package that you are building. See the chapters in Part II on Creating RPMs for more on how to build RPM packages.
rpm -Uhvv jikes-1.16-1.i386.rpm
D: ============== jikes-1.16-1.i386.rpm D: Expected size: 702988 = lead(96)+sigs(100)+pad(4)+data(702788) D: Actual size: 702988 D: jikes-1.16-1.i386.rpm: MD5 digest: OK (2dba32192eca23eb480d1d02a9b6c022) D: added binary package [0] D: found 0 source and 1 binary packages D: opening db environment /var/lib/rpm/Packages joinenv D: opening db index /var/lib/rpm/Packages rdonly mode=0x0 D: locked db index /var/lib/rpm/Packages D: ========== +++ jikes-1.16-1 D: opening db index /var/lib/rpm/Depends create mode=0x0 D: Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 YES (rpmlib provides) D: opening db index /var/lib/rpm/Providename rdonly mode=0x0 D: opening db index /var/lib/rpm/Pubkeys rdonly mode=0x0 D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: ld-linux.so.2 YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6 YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libm.so.6 YES (db provides) D: read h# 633 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libstdc++-libc6.2-2.so.3 YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6(GLIBC_2.0) YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6(GLIBC_2.1) YES (db provides) D: read h# 9 Header V3 DSA signature: NOKEY, key ID 897da07a D: Requires: libc.so.6(GLIBC_2.1.3) YES (db provides) D: Requires: rpmlib(CompressedFileNames) <= 3.0.4-1 YES (rpmlib provides) D: closed db index /var/lib/rpm/Pubkeys D: closed db index /var/lib/rpm/Depends D: closed db index /var/lib/rpm/Providename D: closed db index /var/lib/rpm/Packages D: closed db environment /var/lib/rpm/Packages D: ========== recording tsort relations D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth)D: 0 0 0 0 0 +jikes-1.16-1 D: installing binary packages D: opening db environment /var/lib/rpm/Packages joinenv D: opening db index /var/lib/rpm/Packages create mode=0x42 D: getting list of mounted filesystems D: sanity checking 1 elements D: opening db index /var/lib/rpm/Name create mode=0x42 D: read h# 707 Header sanity check: OK D: computing 3 file fingerprints Preparing... D: computing file dispositions D: opening db index /var/lib/rpm/Basenames create mode=0x42 ########################################### [100%] package jikes-1.16-1 is already installed D: closed db index /var/lib/rpm/Basenames D: closed db index /var/lib/rpm/Name D: closed db index /var/lib/rpm/Packages D: closed db environment /var/lib/rpm/Packagesrpm -U, many programs use two minus signs to indicate longer option names. For example, with the rpm command, -U and --upgrade are treated the same. You can use the short option, -U, or the long option, --upgrade.
--percent. The --percent option prints out decimal numbers that show the percentage completed as the rpm command executes. This option is most useful if you wrap the rpm command within some other command, such as a graphical user interface created from a Perl, Python, or Tcl/Tk script.
rpm -U --percent jikes-1.16-1.i386.rpm
%% 0.000000 %% 2.661902 %% 5.318614 %% 10.632039 %% 15.945465 %% 18.602177 %% 23.915603 %% 29.229028 %% 34.542453 %% 39.855879 %% 45.169304 %% 50.482729 %% 53.139442 %% 55.796154 %% 61.109580 %% 66.423005 %% 71.736430 %% 74.393143 %% 79.706568 %% 82.363281 %% 87.676706 %% 90.333419 %% 95.646844 %% 98.303557 %% 99.422736 %% 99.910411 %% 99.994892 %% 100.000000--percent option are really meant to be input into another program, perhaps a program that shows a graphical progress meter. Each number output then updates the meter.
rpm –U command or the rpm –i command to install a package. When the rpm command installs a package, it goes through a number of steps:
rpm checks that all the dependencies are installed. Dependencies are packages required by the RPM package you want to install. For example, a database-administration package for a particular database may require that the database itself was already installed.
rpm command checks for conflicting packages. For example, when you are trying to install an older version of a package on top of a newer version, running the rpm command alerts you to that conflict. This conflict-checking goes deeper than packages, though. Individual files may conflict if you are trying to install a package that has an older version of a particular file.
rpm command executes the preinstallation tasks (covered in depth in Part II). After all this preparatory work, the rpm command finally gets down to business and installs the files in the package. These files are stored in compressed format (compressed with gzip compression) inside the RPM file.
rpm command updates the RPM database to reflect the new package information. This update is very important and allows you to track packages.
--test command-line option tells the rpm command to test the installation or upgrade process but not to install the file. For example, the following command performs an upgrade or install of the jikes package, but in test mode only. No files will actually be installed.
rpm -U --test jikes-1.16-1.i386.rpm
package jikes-1.16-1 is already installed
chap4.txt: not an rpm package (or package manifest):eruby, such as eruby-devel-0.9.8-2.i386.rpm, will depend on a base ruby package.
ruby packages by using a command like the following:
rpm -q rubyruby package, you'll see a message like the following:
package ruby is not installedruby.
--test option comes in handy, since you can check that the dependencies are resolved prior to trying to install. (Note that the rpm command will check dependencies on real installs as well. The --test option just allows you to check that the installation will succeed prior to trying it.) For example, if you try to install a package named eruby-devel-0.9.8-2.i386.rpm, you may want to run a --test option first:
rpm -U --test eruby-devel-0.9.8-2.i386.rpmruby packages installed:
error: Failed dependencies: eruby-libs = 0.9.8 is needed by eruby-devel-0.9.8-2eruby-devel-0.9.8-2.i386.rpm depends on another package, eruby-libs in this case. In fact, this package depends on the eruby-libs package having a version number of 0.9.8. These packages are obviously interrelated. From the name eruby-libs, you can guess that the package will be in a file with a name like eruby-libs-0.9.8-2.i386.rpm. (I cheated and used the actual package on the Red Hat installation CDs.)
eruby-devel-0.9.8-2.i386.rpm
eruby-libs-0.9.8-2.i386.rpm
eruby-devel-0.9.8-2.i386.rpm depends on: eruby-libs-0.9.8-2.i386.rpm. Just to be careful, though, you can test that package as well, with a command like the following:
rpm -U --test eruby-libs-0.9.8-2.i386.rpm
error: Failed dependencies: ruby-libs >= 1.6.4 is needed by eruby-libs-0.9.8-2 libruby.so.1.6 is needed by eruby-libs-0.9.8-2rpm command to install or upgrade one package at a time. You can optionally choose to install or upgrade a number of packages at the same time. Just list each file name on the rpm command line. The basic syntax follows:
rpm -U package1.rpm package2.rpm .. package100.rpm
rpm -U aspell-en-ca-0.33.7.1-16.i386.rpm aspell-en-gb-0.33.7.1-16.i386.rpmaspell packages for Canadian and British English, respectively.
--noorder option tells the rpm command not to reorder the packages you are trying to install. Usually, the rpm command will reorder the list of packages in the best order for handling the dependencies. This option really only comes into play when you are installing more than one package where the packages depend on each other. In most cases, you do not want to use this option, since this may mean that packages fail to properly install because necessary packages are not already installed.
--prefix and --relocate options should make the rpm command relocate a package to a new location. Not all packages allow relocations, though. The basic format of the command with the --prefix option is:
rpm -U --prefix /new/directory package.rpm--relocate option, the command format is:
rpm -i --relocate /old/directory=/new/directory package.rpm--root option to specify a different directory for the rpm command to assume is the system's root, or /, directory. This causes the rpm command to install files under the new root, instead of in system locations under /. This option is most useful for testing the installation of a complete system under a test directory. The command should use the following format:
rpm -U --root /tmp --dbpath /var/lib/rpm jikes-1.16-1.i386.rpm--root option tells the rpm command that the root for this install is in /tmp/. Installs with the --root option take place within a chroot() environment. This is often useful for setting up a test environment.
--dbpath option tells the rpm command that the RPM database is located in the normal location, /var/lib/rpm/.
--dbpath and --root options will give you problems unless you have installed all the dependencies in the same virtual root directory. This includes all the standard Linux C libraries. For example, if you just run the example command, you'll see error output like the following:
error: Failed dependencies: ld-linux.so.2 is needed by jikes-1.16-1 libc.so.6 is needed by jikes-1.16-1 libm.so.6 is needed by jikes-1.16-1 libstdc++-libc6.2-2.so.3 is needed by jikes-1.16-1 libc.so.6(GLIBC_2.0) is needed by jikes-1.16-1 libc.so.6(GLIBC_2.1) is needed by jikes-1.16-1 libc.so.6(GLIBC_2.1.3) is needed by jikes-1.16-1--badreloc option with the --relocate option to permit relocations on all files in the package. Usually, only those paths to files that are listed as relocatable are supported by the --relocate option.
rpm options cause the rpm command to complain about problems and, in general, fail to install your package. You can use a number of options to run roughshod over the RPM and get it to do what you want.
--replacepkgs option tells the rpm command to replace, or reinstall, packages it may have already installed.
--replacefiles option tells the rpm command to overwrite files owned by a another package.
--justdb option tells the rpm command to update the RPM database, not to install the files. You will need to be logged in as the root user to modify the RPM database.
--nosuggest option tells the rpm command to skip any suggestions for packages that may fill in missing dependencies. You almost never want to use this option.
--excludepath option tells the rpm command to exclude all files that start with the given path. For example:
rpm -U --excludepath /usr/lib eruby-devel-0.9.8-2.i386.rpm/usr/lib/.
--allfiles option tells the rpm command to install or upgrade all files in the package, regardless of whether the files exist or not on your hard disk.
--oldpackage tells the rpm command to allow you to install an older version of a package on top of a more recent one. You don't usually want to do this, but you may need to under the following circumstances:
--force, which tells the rpm command to turn on the --replacepkgs, --replacefiles, and --oldpackage modes.
--nodeps command-line option tells the rpm command to skip the dependencies check and install anyway.
rpm command complains with good reason. Unless you really, really know what you are doing, don't force the issue by using these command-line options.
eruby-devel-0.9.8-2.i386.rpm from the previous example. You can force the rpm command to install this package, even though it depends on another package that in turn depends on yet another. The following command will force the installation of the package in the eruby-devel-0.9.8-2.i386.rpm file:
rpm -U --nodeps eruby-devel-0.9.8-2.i386.rpm
rpm -q eruby-devel
eruby-devel-0.9.8-2rpm command not to do certain things, you can use the --aid option to have the rpm command do something nice for you. The --aid option tells the rpm command to add all the packages it would suggest into the set of packages to install. The rpm command has enough information to suggest a package or packages that ought to contain the dependent files.
--aid option depends on a separate package that contains an RPM database with all packages installed. For Red Hat Linux, this package is rpmdb-redhat. This separate database, built as if all packages were installed (all packages that come with Red Hat Linux in this case), allows the rpm command to search for which packages would solve dependencies.
rpm command should run. These include pre- and post-installation scripts, as well as pre- and post-uninstallation scripts. These scripts can perform options such as automatically configuring the application based on the target environment. For example, an installation script may try to detect whether a site uses Postfix or Sendmail for transferring mail messages and configure the newly-installed package accordingly.
rpm command will execute these scripts at the proper time, unless you explicitly turn the command to skip the scripts. The --noscripts option tells the rpm command to skip running the pre- and post-installation scripts.
--nopre option tells the rpm command to skip any pre-installation scripts. The --nopost option tells the rpm command to skip any post-installation scripts.
--nopreun option tells the rpm command to skip any pre-uninstallation scripts, and the --nopostun option tells the rpm command to skip any post-uninstallation scripts.
--noscripts option is the same as turning on all these options.
| Option | Usage |
|---|---|
--nopre
|
Skip pre-installation scripts.
|
--nopost
|
Skip post-installation scripts.
|
--nopreun
|
Skip pre-uninstallation scripts.
|
--nopostun
|
Skip post-uninstallation scripts.
|
--noscripts
|
Skip all the scripts; same as
--nopre, --nopost, --nopreun, and --nopostun.
|
rpm command not to execute all the triggers or not to execute certain triggers. The --notriggers option tells the rpm command to skip all triggers.
--notriggers. The --notriggerin option turns off triggers during installation. The --notriggerun option turns off uninstallation triggers, and the --notriggerpostun option turns off the post-uninstallation triggers.
--notriggers option is the same as all three, --notriggerin, --notriggerun, and --notriggerpostun.
| Option | Usage |
|---|---|
--notriggerin
|
Skip installation triggers.
|
--notriggerun
|
Skip uninstallation triggers.
|
--notriggerpostun
|
Skip post-uninstallation triggers.
|
--notriggers
|
Skip all the triggers; same as
--notriggerin, --notriggerun, and --notriggerpostun.
|
rpm command supports several ignore options that tell the command to ignore some aspect of a package it would normally complain about.
--ignorearch option tells the rpm command to ignore the architecture of the package and install the package, even if the architecture of the package and the architecture of your system do not match. This is a very dangerous option. Linux runs on everything from tiny wristwatches, PDAs such as the Sharp Zaurus, PCs, Macintosh PCs, RISC servers, and all the way up to huge supercomputers and mainframes. If you try to install a binary package compiled for the ARM or PowerPC processor on an Intel-architecture Linux system, the package will at best fail. At worst, it may damage parts of your system.
--ignoreos command-line option tells the rpm command to ignore the operating system. Again, this is likely not a good idea in most situations. Applications compiled for Windows generally won’t run on Linux. SCO Unix systems, however, can run some Linux applications, so you may have a valid reason to ignore the operating system. Again, use only with extreme care.
--ignoresize option tells the rpm command to ignore or skip a check of your hard disk to ensure it has enough space to install the package.
--ignoresize option if you have a nearly full hard disk, especially for a root, or /, partition.
--nodigest option tells the rpm command to skip the test of the digest, the special value that helps verify the package correctness.
--nosignature option tells the rpm command to skip the test of the digest, the encrypted key, that helps also verify the package correctness.
rpm command-line options with extreme care and only after carefully considering the circumstances. Wrongful use of these options may damage your operating system.
--excludedocs command-line option tells the rpm command to ignore any files in the RPM package that are marked as documentation. Considering the general lack of documentation for many Linux applications, you are really asking for trouble by invoking this option. If the documentation takes up a lot of disk space, however, you may want to avoid installing documentation files. This is about the only situation in which this option makes sense.
--excludedocs, the --includedocs command-line parameter tells the rpm command to install documentation. This is usually the default, so you rarely need this option.
rpm –U command works for both installation of new packages and for upgrading. When you get beyond simple installations, you begin to see the power of the RPM system where most operations require just one command. The rpm -U command is a very powerful tool and performs some complex operations with just one command. For example, the following commands show the sequence for upgrading the jpilot package, which is used for Palm PDA synchronization.
# rpm -q jpilot
jpilot-0.97-1
# rpm -U jpilot-0.99.2-8.i386.rpm # rpm -q jpilot
jpilot-0.99.2-8jpilot package is no longer installed. The rpm -U command removed that package.
--noscripts option only turns off the scripts from the new package. If an old package is removed, the uninstallation scripts for the old package still get executed.
--repackage option, which works the same as when removing packages. The --repackage option tells the rpm command to create a package, an RPM file, from any packages it would erase. Note that this option will not create a complete package. You will not be able to reinstall a package created by the --repackage option. At best, the --repackage option provides a backup of the old package, from which you could create a working package. Be careful with the --repackage option.
--repackage option.
rpm -U --repackage jpilot-0.99.2-8.i386.rpmjdk-1.3.1_01.i386.rpm for the 1.3.1 version but changes to j2sdk-1_4_0_01-fcs-linux-i386.rpm for the 1.4.0 version.
rpm command really shines in the upgrade process. Not only can you upgrade a package with one simple command, but the rpm command has some built-in smarts that really help.
rpm command checks each file in the package. It actually compares checksums of the files. An MD5 checksum is a small value computed from the data in a file. Any change to a file results in a different checksum value.
rpm command compares the checksums of three versions of each file: the version of the file from the old package, the version of the file in the new package, and the version of the file on disk.
rpm command looks at all three versions of the files to handle the common case where you may have edited a configuration file on disk. This is where the rpm command starts working with some upgrade rules. Note that this special processing only applies to files marked as configuration files within the RPM. Chapter 9, Working with Spec Files covers how to mark files as configuration files.
rpm command simply installs the file from the new version of the package on top of the old file.
rpm command leaves that file alone. The rpm command makes the assumption that if the file hasn’t changed between versions of the package, and you have modified the file, chances are your file will work with the new package. This takes care of the common case where you have edited an application’s configuration files.
rpm command installs the new version of the file on top of your changed version. This is because the new version of the file is known to work with the new package. The rpm command saves your work by backing up your modified configuration file, renaming the file with a new .rpmsave extension. The rpm command also warns you that it is backing up your modified file with a message that tells you the old file name and the new file name.
%config(noreplace) with the file, then the rpm command will store the new file with a rpmnew extension if you have modified the file on disk.
-F option.
rpm -F package_name--freshen long option in place of -F.
rpm command are the same, except for the -F or --freshen option that indicates the operation. These are the options discussed in the sections on upgrading and installing software.
–i or --install option tells the rpm command to run an installation operation, which, as you’d suspect, installs packages. The basic syntax is:
rpm –i filename.rpm
rpm –i jikes-1.16-1.i386.rpmrpm -U, not rpm -i. One of the main reasons is that rpm -i allows you to install multiple instances of the same (identical) package. This is usually not what you want.
rpm –i command works with the installation options discussed previously. The –U, -F and –i options all accept mostly the same options, except as discussed previously.
rpm command to install packages available on a network. With the rpm command, you can get the packages to install by using the FTP or HTTP network protocols.
rpm command connects to an FTP file server, downloads the named package, and installs that package. With the HyperText Transfer Protocol (HTTP) used for Web pages, the rpm command connects to a Web server, downloads the named package, and installs that package.
rpm command into installing a malicious package from the wrong host.
rpm command is that you need to create a URL for the remote file name. The basic format of the command follows:
rpm -i ftp://hostname/path/to/file/filename.rpm
rpm -i ftp://www-126.ibm.com/pub/jikes/jikes-1.16-1.src.rpmrpm command line, the rpm command will prompt you for the missing data.
rpm -i ftp://unclejoe@www-126.ibm.com/pub/jikes/jikes-1.16-1.src.rpmrpm command will prompt you for the password. You can also include the password on the rpm command line. Separate the user name from the password with a colon (:).
rpm -i ftp://unclejoe:workers@www-126.ibm.com/pub/jikes/jikes-1.16-1.src.rpmrpm command supports the HTTP protocol, used by most Web servers, as well as FTP. Similar to accessing a file via FTP, you need to pass the rpm command a URL identifying the file. For example:
rpm –i http://ftp.redhat.com/pub/contrib/noarch/SRPMS/Squeak-sources-3-1.src.rpmdiff command, and the source code is patched with the patch command.
rpm command is good for more than just installing and upgrading software packages. Many times, you will need to remove packages as well.
-e option to the rpm command, short for erase. The basic syntax follows:
rpm -e package_name
rpm -e jikes-1.16-1jikes-1.16-1 package used in previous examples.
root Access is Requiredroot account, or super user, to remove most packages. This is because the package files themselves are protected. In addition, the RPM database is protected.
rpm command first checks that no other packages depend on the package you intend to remove. This is very important, since you otherwise can damage your Linux system by inadvertently removing packages needed by the rest of the system.
rpm command supports the --test option for removing packages as well as when installing. As with installing, the --test option tells the rpm command to test to see whether it can remove the given package but not to force the removal.
syslinux-1.75-3 package, you can use the --test option to see if this works.
rpm -e --test syslinux-1.75-3
error: Failed dependencies: syslinux is needed by (installed) mkbootdisk-1.4.8-1--erase, in place of –e.
rpm –q command to query whether a package is installed. After running the rpm –e command, you can run the rpm –q command to check whether the package has been removed. If the rpm –q command shows that the package is not installed, that tells you the erase operation has worked.
# rpm -q jikes
jikes-1.16-1
# rpm -e jikes-1.16-1 # rpm -q jikes
package jikes is not installed
rpm -e aspell-en-ca-0.33.7.1-16 aspell-en-gb-0.33.7.1-16aspell-en-ca-0.33.7.1-16 and aspell-en-gb-0.33.7.1-16 packages.
--allmatches option tells the rpm command to remove all packages with names that match the names you pass on the command line. If you do not use the --allmatches option, the rpm command will issue an error if more than one package matches the name or names you pass on the command line.
--nodeps option tells the rpm command to skip the test of dependencies. Use this option when you really, really, want to uninstall a package.
rpm command, can result in damage to your Linux system. Use these options with care.
--repackage option, described previously, tells the rpm command to create a package, an RPM file, from any packages it would erase. These packages will appear in the default repackage directory, which is normally /var/spool/repackage/. Check your RPM settings to be sure of the directory configured on your system.
--repackage option are not full packages. You cannot install these packages.
--noscripts and --notriggers options when removing packages. The --noscripts option tells the rpm command not to run any uninstallation scripts. You can refine this by using either --nopreun or --nopostun in place of the --noscripts option.
--nopreun option tells the rpm command not to run the pre-uninstallation scripts. The --nopostun option tells the rpm command not to run the post-uninstallation scripts.
--notriggers option works in a similar fashion. The --notriggers option tells the rpm command not to execute any triggers. For a finer grain of control, use --notriggerun to prevent any uninstallation triggers and --notriggerpostun to prevent any post-uninstallation triggers.
rpm Command Options-v (for more verbose output) work with the rpm command for installing, removing, and upgrading packages, as well as most other uses of the rpm command.
rpm command options, which work with most RPM actions, include --quiet to turn off most output except for errors, and --root, covered previously.
--rcfile option tells the rpm command to use one or more other files to initialize the RPM system. These files tell the rpm command the system architecture, operating system, and default location of the RPM database, among a host of other settings.
rc Filesrc comes from Unix shells, with initialization files such as .cshrc for the C shell, csh. The term rc was originally a shorthand for run commands. An rc is a file of commands that run when the application starts up. For example, the C shell, csh, runs the commands in file named .cshrc when the shell starts.
rpm command, this file is .rpmrc. The leading period makes the file hidden for most directory listings.
/etc/rpmrc (with no leading period) that customizes the rpm command for all users on your system. See Chapter 20, Customizing RPM Behavior for a more in-depth look at the chain of these files.
--rcfile option is
--rcfile filename
--rcfile filename1:filename2:filename3
/usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc:/etc/rpmrc:~/.rpmrc~/.rpmrc means to look in the user's home directory for a file named rpmrc.
--showrc option to list all the rc settings.
--showrc Option--showrc option.
--version option tells the rpm command to print out the version number of the command and then exit. For example:
rpm --version
RPM version 4.1--dbpath option, mentioned previously, tells the rpm command to use a different RPM database. This is useful when testing a complete system install, where you want to change the RPM database but don't want that to affect your running Linux system. In this case, you can use a different RPM database and test out your changes. The basic syntax for this option is:
--dbpath directory_name
--pipe option tells the rpm command to send, or pipe, its output to another program. The syntax for this option is:
--pipe command_to_send_out_to
rpm –e command removes packages. The rpm –U command upgrades packages by installing new packages and removing old versions of all the packages upgraded. RPM upgrades also work for installing new packages. The rpm –F command freshens packages. This command only upgrades a package if an older version of the package has already been installed. The rpm –i command installs packages.
rpm command-line options for installing, removing, and upgrading packages.
rpm command| Command | Usage |
|---|---|
rpm –i
|
Install packages.
|
rpm –e
|
Erase, remove, packages.
|
rpm –U
|
Upgrade or install packages. Use this option for installations.
|
rpm –Uvh
|
Upgrade or install packages with extra output. This is the recommended command to install packages.
|
rpm –F
|
Freshen packages.
|
rpm –i command performs an installation operation, and the rpm –U command performs an upgrade.
–q, short for query. This option tells the rpm command to query the RPM database. You can also use the long option --query.
–q option with the rpm command to query just for the presence or absence of installed packages. You can expand the -q option to perform a wide array of queries to find out information about the packages installed on a Linux system.
rpm –q command follows:
rpm –q package_name
rpm -q telnet-0.17
telnet-0.17-20
package telnet-0.17 is not installed
rpm -q telnet
telnet-0.17-20
rpm -q telnet telnet-server
telnet-0.17-20
telnet-server-0.17-20
–a option tells the rpm command to query for all packages. You can also use the longer option, --all, in place of –a.
rpm -qa
m17n-db-gujarati-1.5.5-4.fc13.noarch libvisual-0.4.0-9.fc12.x86_64 hal-filesystem-0.5.14-3.fc13.x86_64 fedora-logos-13.0.2-1.fc13.noarch kdepim-runtime-libs-4.4.5-1.fc13.x86_64 lpsolve-5.5.0.15-3.fc13.x86_64 kipi-plugins-1.2.0-1.fc13.x86_64 kbd-1.15-9.fc12.x86_64 perl-Glib-1.201-4.fc12.x86_64 kdeplasma-addons-4.4.5-1.fc13.x86_64
rpm –qa command to see the full output for your system.
rpm –qa command executes surprisingly fast.
more or less programs, and display the output one page at a time.
more and less, the rpm –qa command outputs too much information to be really useful, unless you can somehow filter the information automatically.
grep command provides a powerful tool for filtering through textual data. If you pipe the output of the rpm –qa command into the grep command, you have a powerful search engine at your fingertips.
rpm -qa | grep ssh
ksshaskpass-0.5.3-1.fc13.x86_64 openssh-server-5.4p1-3.fc13.x86_64 libssh2-1.2.4-1.fc13.i686 openssh-askpass-5.4p1-3.fc13.x86_64 libssh2-1.2.4-1.fc13.x86_64 openssh-5.4p1-3.fc13.x86_64 openssh-clients-5.4p1-3.fc13.x86_64 libssh-0.4.4-1.fc13.x86_64
rpm -qa --pipe "grep ssh"
|
Convention
|
Usually indicates
|
|
Starts with g
|
GNOME desktop application or a GNU application, especially GNU C programming tools and libraries
|
|
Starts with j
|
Cross-platform Java application
|
|
Starts with k
|
KDE desktop application, Linux kernel package, or Kerberos security package
|
|
Starts with py
|
Python application
|
|
Starts with rh
|
Red Hat application, usually for configuring your system
|
|
Starts with tk
|
Graphical Tcl application
|
|
Starts with x
|
X Window System graphical desktop application
|
|
Ends with wm
|
Window manager for controlling the layout of windows on the screen
|
rpm –qa (but not just rpm –q, you need the –a to look for all packages). For example:
rpm -qa "kernel*"
kernel-2.6.33.6-147.fc13.x86_64 kernel-2.6.33.5-112.fc13.x86_64 kernel-devel-2.6.33.5-112.fc13.x86_64 kernel-headers-2.6.33.6-147.fc13.x86_64 kernel-2.6.33.5-124.fc13.x86_64 kernel-devel-2.6.33.5-124.fc13.x86_64 kernel-devel-2.6.33.6-147.fc13.x86_64
grep –v and searches for all packages that do not start with "send".
rpm –qa command to better filter and display the data, such as wc –l to count the number of packages that you query. You can also use a number of other query options to find out more specialized information from the RPM database.
-qf option tells the rpm command to query for all packages that own a particular file. You can also use the longer option, --file, in place of –f. The basic syntax follows:
rpm -qf filename
which command, if the program is in your path. (The grep program must be in your path, or commands with grep will fail.)
which grep
/bin/grep
rpm -qf /bin/grep
grep-2.6.3-1
rpm -qf `which grep`
grep-2.6.3-1
rpm -qf $(which grep)
grep-2.6.3-1
rpm -qf mail
file mail is not owned by any package
rpm -qf `which ssh`
openssh-clients-5.4p1-3
rpm –qf command proves very useful. Otherwise, you would just have to know that OpenSSH is the project responsible for this command.
rpm -qf command follows symbolic links. This was not always true with older versions of RPM, but modern RPM versions can trace package ownership to files placed in linked directories.
rpm -qf /usr/lib/X11/XKeysymDB
XFree86-4.2.0-72
–i option with an rpm query command tells the rpm command to output descriptive information about the package. You can also use the longer option, --info, in place of –i. The basic syntax is:
rpm -qi package
rpm –MajorOperation –extra_options packages_or_files
rpm –i installs packages and rpm –q queries packages. The rpm –qi command outputs the descriptive information on packages. If you make a mistake and place the i in front of the q, you are telling the rpm command to perform a different operation.
rpm -qi tcsh-6.17-6
Name : tcsh Relocations: (not relocateable) Version : 6.17 Vendor: Fedora Project Release : 6 Build Date: Tue 15 Dec 2009 11:28:11 AM EST Install Date: Fri 27 Aug 2010 07:41:03 PM EDT Build Host: localhost Group : System Environment/Shells Source RPM: tcsh-6.17-6.fc13.src.rpm Size : 1191282 License: BSD Signature : RSA/SHA256, Fri 05 Feb 2010 09:30:43 AM EST, Key ID 7edc6ad6e8e40fde Packager : Fedora Project URL : http://www.tcsh.org/ Summary : An enhanced version of csh, the C shell Description : Tcsh is an enhanced but completely compatible version of csh, the C shell. Tcsh is a command language interpreter which can be used both as an interactive login shell and as a shell script command processor. Tcsh includes a command line editor, programmable word completion, spelling correction, a history mechanism, job control and a C language like syntax.
rpm –qi, as well as any other header tag.
rpm –qi command, shown previously, lists the group for a package, if there is one. For the tcsh package shown in the previous example, the package is System Environment/Shells.
–g option to rpm –q tells rpm to list all the packages in a given group. You can also use the longer option, --group, in place of –g. The basic syntax follows:
rpm –qg group_name
rpm -qg "System Environment/Shells"
dash-0.5.5.1-3.x86_64 bash-4.1.7-1.x86_64 tcsh-6.17-6.x86_64
–l (ell) option queries all the files in a package. You can also use the longer option, --list, in place of –l. The basic syntax is:
rpm -ql tcsh
/bin/csh
/bin/tcsh
/usr/share/doc/tcsh-6.10
/usr/share/doc/tcsh-6.10/FAQ
/usr/share/doc/tcsh-6.10/Fixes
/usr/share/doc/tcsh-6.10/NewThings
/usr/share/doc/tcsh-6.10/complete.tcsh
/usr/share/doc/tcsh-6.10/eight-bit.txt
/usr/share/doc/tcsh-6.10/tcsh.html
/usr/share/doc/tcsh-6.10/tcsh.html/header.html
/usr/share/doc/tcsh-6.10/tcsh.html/index.html
/usr/share/doc/tcsh-6.10/tcsh.html/lists.html
/usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man
/usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man2html
/usr/share/doc/tcsh-6.10/tcsh.html/top.html
/usr/share/locale/de/LC_MESSAGES/tcsh
/usr/share/locale/el/LC_MESSAGES/tcsh
/usr/share/locale/es/LC_MESSAGES/tcsh
/usr/share/locale/fr/LC_MESSAGES/tcsh
/usr/share/locale/it/LC_MESSAGES/tcsh
/usr/share/locale/ja/LC_MESSAGES/tcsh
/usr/share/man/man1/tcsh.1.gz
--filesbypkg option to list files by package.
rpm -q --filesbypkg file openssh-clients
file /usr/bin/file
file /usr/share/magic
file /usr/share/magic.mgc
file /usr/share/magic.mime
file /usr/share/man/man1/file.1.gz
file /usr/share/man/man5/magic.5.gz
openssh-clients /etc/ssh/ssh_config
openssh-clients /usr/bin/sftp
openssh-clients /usr/bin/slogin
openssh-clients /usr/bin/ssh
openssh-clients /usr/bin/ssh-add
openssh-clients /usr/bin/ssh-agent
openssh-clients /usr/bin/ssh-keyscan
openssh-clients /usr/share/man/man1/sftp.1.gz
openssh-clients /usr/share/man/man1/slogin.1.gz
openssh-clients /usr/share/man/man1/ssh-add.1.gz
openssh-clients /usr/share/man/man1/ssh-agent.1.gz
openssh-clients /usr/share/man/man1/ssh-keyscan.1.gz
openssh-clients /usr/share/man/man1/ssh.1.gz
rpm -qlv tcsh
lrwxrwxrwx 1 root root 4 Dec 15 2009 /bin/csh -> tcsh -rwxr-xr-x 1 root root 386984 Dec 15 2009 /bin/tcsh drwxr-xr-x 2 root root 0 Dec 15 2009 /usr/share/doc/tcsh-6.17 -rw-r--r-- 1 root root 17782 Mar 2 2006 /usr/share/doc/tcsh-6.17/BUGS -rw-r--r-- 1 root root 12773 May 19 2004 /usr/share/doc/tcsh-6.17/FAQ -rw-r--r-- 1 root root 85246 Jul 10 2009 /usr/share/doc/tcsh-6.17/Fixes -rw-r--r-- 1 root root 6518 Oct 2 1998 /usr/share/doc/tcsh-6.17/NewThings -rw-r--r-- 1 root root 11809 May 19 2004 /usr/share/doc/tcsh-6.17/WishList -rw-r--r-- 1 root root 56615 Oct 1 2007 /usr/share/doc/tcsh-6.17/complete.tcsh -rw-r--r-- 1 root root 46682 Dec 15 2009 /usr/share/locale/de/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 48387 Dec 15 2009 /usr/share/locale/el/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 45670 Dec 15 2009 /usr/share/locale/en/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 48234 Dec 15 2009 /usr/share/locale/es/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 45130 Dec 15 2009 /usr/share/locale/et/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 47757 Dec 15 2009 /usr/share/locale/fi/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 47978 Dec 15 2009 /usr/share/locale/fr/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 49085 Dec 15 2009 /usr/share/locale/it/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 33848 Dec 15 2009 /usr/share/locale/ja/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 45160 Dec 15 2009 /usr/share/locale/pl/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 46148 Dec 15 2009 /usr/share/locale/ru/LC_MESSAGES/tcsh -rw-r--r-- 1 root root 45492 Dec 15 2009 /usr/share/locale/uk/LC_MESSAGES/tcsh lrwxrwxrwx 1 root root 9 Dec 15 2009 /usr/share/man/man1/csh.1.gz -> tcsh.1.gz -rw-r--r-- 1 root root 63984 Dec 15 2009 /usr/share/man/man1/tcsh.1.gz
–l option results in quite a lot of output. In some cases, though, you aren’t interested in documentation and other miscellaneous files in the package. It’s the commands and libraries that cause the most package-related problems. To help with this, you can use a series of rpm options to list only certain types of files.
–c option tells rpm –q to list the configuration files for a package. You can also use the longer option, --configfiles, in place of –c. The basic syntax is:
rpm –qc package_name
rpm -qc bash
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
rpm -qc python
rpm -qc sendmail
/etc/aliases
/etc/mail/Makefile
/etc/mail/access
/etc/mail/domaintable
/etc/mail/helpfile
/etc/mail/local-host-names
/etc/mail/mailertable
/etc/mail/sendmail.mc
/etc/mail/statistics
/etc/mail/trusted-users
/etc/mail/virtusertable
/etc/rc.d/init.d/sendmail
/etc/sendmail.cf
/etc/sysconfig/sendmail
/usr/lib/sasl/Sendmail.conf
–l option, the –v option provides more information on each file, as shown following:
rpm -qcv bash
-rw-r--r-- 1 root root 18 May 21 13:32 /etc/skel/.bash_logout -rw-r--r-- 1 root root 176 May 21 13:32 /etc/skel/.bash_profile -rw-r--r-- 1 root root 124 May 21 13:32 /etc/skel/.bashrc
–c option, the –d option tells the rpm –q command to list just the documentation files for a package. The basic syntax is:
rpm –qd package_name
rpm -qd tcsh
/usr/share/doc/tcsh-6.10/FAQ
/usr/share/doc/tcsh-6.10/Fixes
/usr/share/doc/tcsh-6.10/NewThings
/usr/share/doc/tcsh-6.10/complete.tcsh
/usr/share/doc/tcsh-6.10/eight-bit.txt
/usr/share/doc/tcsh-6.10/tcsh.html/header.html
/usr/share/doc/tcsh-6.10/tcsh.html/index.html
/usr/share/doc/tcsh-6.10/tcsh.html/lists.html
/usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man
/usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man2html
/usr/share/doc/tcsh-6.10/tcsh.html/top.html
/usr/share/man/man1/tcsh.1.gz
--docfiles, in place of –d.
–s option to the rpm –q command lists the state of each file in a package. The basic syntax is:
rpm –qs package_name
rpm -qs tcsh
normal /bin/csh
normal /bin/tcsh
normal /usr/share/doc/tcsh-6.10
normal /usr/share/doc/tcsh-6.10/FAQ
normal /usr/share/doc/tcsh-6.10/Fixes
normal /usr/share/doc/tcsh-6.10/NewThings
normal /usr/share/doc/tcsh-6.10/complete.tcsh
normal /usr/share/doc/tcsh-6.10/eight-bit.txt
normal /usr/share/doc/tcsh-6.10/tcsh.html
normal /usr/share/doc/tcsh-6.10/tcsh.html/header.html
normal /usr/share/doc/tcsh-6.10/tcsh.html/index.html
normal /usr/share/doc/tcsh-6.10/tcsh.html/lists.html
normal /usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man
normal /usr/share/doc/tcsh-6.10/tcsh.html/tcsh.man2html
normal /usr/share/doc/tcsh-6.10/tcsh.html/top.html
not installed /usr/share/locale/de/LC_MESSAGES/tcsh
not installed /usr/share/locale/el/LC_MESSAGES/tcsh
not installed /usr/share/locale/es/LC_MESSAGES/tcsh
not installed /usr/share/locale/fr/LC_MESSAGES/tcsh
not installed /usr/share/locale/it/LC_MESSAGES/tcsh
not installed /usr/share/locale/ja/LC_MESSAGES/tcsh
normal /usr/share/man/man1/tcsh.1.gz
--state, in place of –s.
–s option with other file filters, such as –d, for listing only the documentation files for a package.
|
State
|
Usage
|
|
normal
|
The file has been installed.
|
|
not installed
|
The file from the package is not installed.
|
|
replaced
|
The file has been replaced.
|
--excludedocs. This can lead to non-normal states. You may have also modified files installed from a given package.
--scripts option to the rpm –q command lists the scripts associated with a package. The basic syntax follows:
rpm -q --scripts package_name
rpm -q --scripts tcsh
if [ ! -f /etc/shells ]; then echo "/bin/tcsh" >> /etc/shells echo "/bin/csh" >> /etc/shells else grep -q '^/bin/tcsh$' /etc/shells || \ echo "/bin/tcsh" >> /etc/shells grep -q '^/bin/csh$' /etc/shells || \ echo "/bin/csh" >> /etc/shells fi postuninstall scriptlet (using /bin/sh): if [ ! -x /bin/tcsh ]; then grep -v '^/bin/tcsh$' /etc/shells | \ grep -v '^/bin/csh$' > /etc/shells.rpm && \ mv /etc/shells.rpm /etc/shells fi
rpm -q --scripts sendmail
preinstall scriptlet (using /bin/sh):
/usr/sbin/useradd -u 47 -d /var/spool/mqueue -r -s /sbin/nologin mailnull >/dev/null 2>&1
/usr/sbin/useradd -u 51 -d /var/spool/mqueue -r -s /sbin/nologin smmsp >/dev/null 2>&1
exit 0
postinstall scriptlet (using /bin/sh):
/sbin/chkconfig --add sendmail
# Set up the alternatives files for MTAs.
/usr/sbin/alternatives --install /usr/sbin/sendmail mta /usr/sbin/sendmail.sendmail 90 \
--slave /usr/bin/mailq mta-mailq /usr/bin/mailq.sendmail \
--slave /usr/bin/newaliases mta-newaliases /usr/bin/newaliases.sendmail \
--slave /usr/bin/rmail mta-rmail /usr/bin/rmail.sendmail \
--slave /usr/lib/sendmail mta-sendmail /usr/lib/sendmail.sendmail \
--slave /etc/pam.d/smtp mta-pam /etc/pam.d/smtp.sendmail \
--slave /usr/share/man/man8/sendmail.8.gz mta-sendmailman /usr/share/man/man8/sendmail.sendmail.8.gz \
--slave /usr/share/man/man1/mailq.1.gz mta-mailqman /usr/share/man/man1/mailq.sendmail.1.gz \
--slave /usr/share/man/man1/newaliases.1.gz mta-newaliasesman /usr/share/man/man1/newaliases.sendmail.1.gz \
--slave /usr/share/man/man5/aliases.5.gz mta-aliasesman /usr/share/man/man5/aliases.sendmail.5.gz \
--initscript sendmail
# Rebuild maps
{
chown root /etc/aliases.db /etc/mail/access.db \
/etc/mail/mailertable.db /etc/mail/domaintable.db \
/etc/mail/virtusertable.db
SM_FORCE_DBREBUILD=1 /etc/mail/make
SM_FORCE_DBREBUILD=1 /etc/mail/make aliases
} > /dev/null 2>&1
exit 0
preuninstall scriptlet (using /bin/sh):
if [ $1 = 0 ]; then
/etc/rc.d/init.d/sendmail stop >/dev/null 2>&1
/sbin/chkconfig --del sendmail
/usr/sbin/alternatives --remove mta /usr/sbin/sendmail.sendmail
fi
exit 0
postuninstall scriptlet (using /bin/sh):
if [ "$1" -ge "1" ]; then
/etc/rc.d/init.d/sendmail condrestart >/dev/null 2>&1
mta=`readlink /etc/alternatives/mta`
if [ "$mta" == "/usr/sbin/sendmail.sendmail" ]; then
/usr/sbin/alternatives --set mta /usr/sbin/sendmail.sendmail
fi
fi
exit 0
--changelog option lists what has changed, as described in a file that logs changes, from previous versions of a given package. The change log is just a convention, so not all packages will sport this nifty feature. In addition, the change log for many packages documents the changes in the RPM packaging, not the changes in the underlying application. If a change log is available, however, this can prove a very good way to help determine whether you want to upgrade to a new version of a package.
rpm –q --changelog package_name
rpm -q --changelog bash
* Fri May 21 2010 Roman Rakus rrakus@redhat.com - 4.1.7-1 - Patch level 7 * Wed Mar 31 2010 Roman Rakus rrakus@redhat.com - 4.1.2-4 - Corrected requires patch (#563301) * Fri Jan 22 2010 rrakus@redhat.com 4.1.2-3 - Don't use cond-rmatch patch - Use manso patch - Include COPYING in base bash rpm * Fri Jan 22 2010 rrakus@redhat.com 4.1.2-2 - Correct patchlevel 2 * Fri Jan 22 2010 Roman Rakus rrakus@redhat.com 4.1.2-1 - Patchlevel 4.2 - Removed old patch - Returned back manso patch * Fri Jan 08 2010 Roman Rakus rrakus@redhat.com 4.1.0-2 - Include COPYING in doc dir * Mon Jan 04 2010 Roman Rakus rrakus@redhat.com - 4.1.0-1 - Upstream 4.1 * Sun Dec 27 2009 Roman Rakus rrakus@redhat.com - 4.1-0.2.rc1 - Fixed patch for fuzz=0 * Sun Dec 27 2009 Roman Rakus rrakus@redhat.com - 4.1-0.1.rc1 - Upstream 4.1.rc1 * Fri Dec 11 2009 Roman Rakus rrakus@redhat.com - 4.0.35-2 - Don't segfault when TERM=eterm* and EMACS is unset (#530911) * Thu Oct 29 2009 Roman Rakus rrakus@redhat.com - 4.0.35-1 - Patch level 35
rpm –q and add the various options either on their own, such as –q with –s and –f, or together, such as –qsf.
–qdi option to rpm (a combination of the –q, –d, and –i options):
rpm -qdi grep
Name : grep Relocations: (not relocatable) Version : 2.6.3 Vendor: Fedora Project Release : 1.fc13 Build Date: Wed 07 Apr 2010 05:58:58 PM EDT Install Date: Fri 27 Aug 2010 07:03:07 PM EDT Build Host: x86-06.phx2.fedoraproject.org Group : Applications/Text Source RPM: grep-2.6.3-1.fc13.src.rpm Size : 800493 License: GPLv3+ Signature : RSA/SHA256, Wed 07 Apr 2010 06:48:20 PM EDT, Key ID 7edc6ad6e8e40fde Packager : Fedora Project URL : http://www.gnu.org/software/grep/ Summary : Pattern matching utilities Description : The GNU versions of commonly used grep utilities. Grep searches through textual input for lines which contain a match to a specified pattern and then prints the matching lines. GNU's grep utilities include grep, egrep and fgrep. GNU grep is needed by many scripts, so it shall be installed on every system. /usr/share/doc/grep-2.6.3/ABOUT-NLS /usr/share/doc/grep-2.6.3/AUTHORS /usr/share/doc/grep-2.6.3/COPYING /usr/share/doc/grep-2.6.3/ChangeLog /usr/share/doc/grep-2.6.3/NEWS /usr/share/doc/grep-2.6.3/README /usr/share/doc/grep-2.6.3/THANKS /usr/share/doc/grep-2.6.3/TODO /usr/share/info/grep.info.gz /usr/share/man/man1/egrep.1.gz /usr/share/man/man1/fgrep.1.gz /usr/share/man/man1/grep.1.gz
–qcsf option with the name of the file, as shown here, or the -qcs option with the name of a package.
rpm -qcsf /bin/bash
normal /etc/skel/.bash_logout normal /etc/skel/.bash_profile normal /etc/skel/.bashrc
--last option. This is very useful if you recently installed or upgraded a number of packages and something unexpected happens. If you cannot remember the package names, you can use the --last option to list out packages in reverse order of installation.
rpm -qa --last | head
kmod-nvidia-2.6.34.6-47.fc13.x86_64-256.53-1.fc13 Sat 18 Sep 2010 09:54:48 AM EDT xorg-x11-drv-nvidia-256.53-1.fc13 Sat 18 Sep 2010 09:51:00 AM EDT kmod-nvidia-2.6.34.6-54.fc13.x86_64-256.53-1.fc13.3 Sat 18 Sep 2010 09:50:59 AM EDT xorg-x11-drv-nvidia-libs-256.53-1.fc13 Sat 18 Sep 2010 09:50:57 AM EDT google-talkplugin-1.5.1.0-1 Wed 15 Sep 2010 07:38:46 PM EDT mythplugins-0.23.1-2.fc13 Sun 12 Sep 2010 09:35:42 PM EDT mythweather-0.23.1-2.fc13 Sun 12 Sep 2010 09:35:40 PM EDT perl-DateTime-Format-ISO8601-0.07-1.fc13 Sun 12 Sep 2010 09:35:39 PM EDT perl-DateTime-Format-Builder-0.7901-5.fc13 Sun 12 Sep 2010 09:35:38 PM EDT perl-Class-Factory-Util-1.7-6.fc13 Sun 12 Sep 2010 09:35:37 PM EDT
--qf or --queryformat option allows you to create custom queries with the rpm command, although in a rather difficult manner. You need to pass a query format string, the syntax of which originates with the C printf function and requires precision.
%{tag_name}. (The percent sign is about the only part that comes from the C printf function.) You can combine tag names to display more than one item per package. You can also add formatting options following C language conventions.
rpm -qa --qf "%{NAME}"
libxml2tcp_wrappers-libstracerouteperl-Config-Tinylibsampleratefedora-icon-themefftw2dvb-appsreport-plugin-localsaveglib2-develqwtintltoolperl-Locale-Maketext-Gettextliblastfmxorg-x11-fonts-ISO8859-1-100dpilibpng-devellibgeotifffontconfigPackageKit-glibshared-mime-infoxorg-x11-drv-sisusbxmlgraphics-commonsopenoffice.org-graphicfilterm17n-db-oriyadejavu-sans-fontslibselinux-pythonapr-utilxorg-x11-drv-cirruslibsilcmysql-serverpnm2ppanssmythmusicdbus-glibcyrus-sasl-libfedora-release-notesekigaperl-Net-SSLeayperl-HTML-Parsermingettyphp-clixorg-x11-drv-nvidia-libspatchgnome-games-extra
rpm -qa --qf "%{NAME}\n"
libxml2 tcp_wrappers-libs traceroute perl-Config-Tiny libsamplerate fedora-icon-theme fftw2 dvb-apps report-plugin-localsave glib2-devel
rpm -qa. You’ll likely not use this command in favor of the simpler rpm option, but you can use this example as a guide for creating your own custom queries.
rpm -qa --qf "%-20{NAME} %-20{PLATFORM}\n"
libxml2 x86_64-redhat-linux-gnu tcp_wrappers-libs i686-redhat-linux-gnu traceroute x86_64-redhat-linux-gnu perl-Config-Tiny noarch-redhat-linux-gnu libsamplerate x86_64-redhat-linux-gnu fedora-icon-theme noarch-redhat-linux-gnu fftw2 x86_64-redhat-linux-gnu dvb-apps x86_64-redhat-linux-gnu report-plugin-localsave x86_64-redhat-linux-gnu glib2-devel x86_64-redhat-linux-gnu
--queryformat option, you need to know what tags you can use. To list the names of the available query format tags, use the --querytags option, which returns a large set of tags, truncated here for space:
rpm --querytags
NAME
VERSION
RELEASE
SUMMARY
DESCRIPTION
BUILDTIME
RPMTAG_ prefix, such as RPMTAG_NAME. You can use this tags with or without the RPMTAG_ prefix. For example:
rpm -q --qf "%{RPMTAG_NAME}\n" sendmail
sendmail
–q option to query for one package, instead of –qa to query for all packages. You can use query formats with any of the rpm queries.
|
Tag
|
Holds
|
|
NAME
|
Package name
|
|
VERSION
|
Version number
|
|
RELEASE
|
Release number
|
|
SUMMARY
|
One-line summary of the package contents
|
|
DESCRIPTION
|
Descriptive text about the package
|
|
BUILDTIME
|
Time package was built
|
|
BUILDHOST
|
Host package was built on
|
|
SIZE
|
Size of all the regular files in the payload
|
|
LICENSE
|
License package was released under
|
|
GROUP
|
Descriptive group or category name for the package
|
|
OS
|
Operating system package was built for
|
|
ARCH
|
Architecture, such as i386
|
|
SOURCERPM
|
The associated source RPM
|
|
CHANGELOGTIME
|
Array of changelog times
|
|
CHANGELOGNAME
|
Array of changelog names
|
|
CHANGELOGTEXT
|
Array of changelog text entries
|
|
PREIN
|
Pre-install script
|
|
POSTIN
|
Post-install script
|
|
PREUN
|
Pre-uninstall script
|
|
POSTUN
|
Post uninstall script
|
|
PLATFORM
|
Platform
|
CHANGELOGTIME, CHANGELOGTEXT and CHANGELOGNAME tags, are single-value tags.
rpm -q --queryformat "[%-50{FILENAMES} %{FILESIZES}\n]" sendmail
/etc/NetworkManager/dispatcher.d/10-sendmail 96 /etc/mail 4096 /etc/mail/Makefile 92 /etc/mail/access 469 /etc/mail/access.db 0 /etc/mail/aliasesdb-stamp 0 /etc/mail/domaintable 233 /etc/mail/domaintable.db 0 /etc/mail/helpfile 5584 /etc/mail/local-host-names 64
=, in front of the tag name to specify that the given tag should be repeated for each item in the array. For example:
rpm -q --queryformat "[%-15{=NAME} %-50{FILENAMES}\n]" sendmail bash
sendmail /etc/NetworkManager/dispatcher.d/10-sendmail sendmail /etc/mail sendmail /etc/mail/Makefile sendmail /etc/mail/access sendmail /etc/mail/access.db bash /bin/bash bash /bin/sh bash /etc/skel/.bash_logout bash /etc/skel/.bash_profile bash /etc/skel/.bashrc
%{tag:special_format}
INSTALLTIME tag, use %{INSTALLTIME:date}, which specifies to print the INSTALLTIME tag in date format. For example:
rpm -q --qf "%{NAME}-%{VERSION}-%{RELEASE} %{INSTALLTIME:date}\n" bash
bash-4.1.7-1.fc13 Fri 27 Aug 2010 07:02:33 PM EDT
NAME-VERSION-RELEASE of the package, along with the INSTALLTIME in date format.
%|tag?{print_if_present}:{print_if_absent}|
rpm -q --qf "%{NAME} %|EPOCH?{%{EPOCH}}:{(no Epoch)}|\n" perl
perl 4
EPOCH tag, you will see output as shown in this example. Most packages do not have an EPOCH defined, in which case, you will \ see output like the following:
rpm -q --qf "%{NAME} %|EPOCH?{%{EPOCH}}:{(no Epoch)}|\n" sendmail
sendmail (no Epoch)
|
Tag
|
Holds
|
|
CONFLICTFLAGS
|
Array of flags for the capabilities this package conflicts
|
|
CONFLICTNAME
|
Array of capabilities that this package conflicts
|
|
CONFLICTVERSION
|
Array of version numbers that this package conflicts
|
|
REQUIREFLAGS
|
Array of flags for the capabilities this package requires
|
|
REQUIRENAME
|
Array of capabilities that this package requires
|
|
REQUIREVERSION
|
Array of version numbers that this package requires
|
|
OBSOLETENAME
|
Array of capabilities that this package obsoletes
|
|
OBSOLETEFLAGS
|
Array of flags for the capabilities this package obsoletes
|
|
OBSOLETEVERSION
|
Array of version numbers that this package obsoletes
|
|
PROVIDENAME
|
Array of capabilities that this package provides
|
|
PROVIDEFLAGS
|
Array of flags for the capabilities this package provides
|
|
PROVIDEVERSION
|
Array of version numbers that this package provides
|
|
Tag
|
Holds
|
|
OLDFILENAMES
|
Array of full file names, used in older packages
|
|
FILESIZES
|
Array of sizes for each file
|
|
FILEMODES
|
Array of permissions for each file
|
|
FILERDEVS
|
Array of rdev values for each file
|
|
FILEMTIMES
|
Array of modified times for each file
|
|
FILEMD5S
|
MD5 checksum for each file
|
|
FILELINKTOS
|
Array of link information for each file
|
|
FILEFLAGS
|
Array of flags for each file
|
|
FILEUSERNAME
|
Array of user names for the file owners
|
|
FILEGROUPNAME
|
Array of group names for the file owners
|
|
FILEDEVICES
|
Array of devices for each file
|
|
FILEINODES
|
Array of inodes for each file
|
|
FILELANGS
|
Array of language flags for each file
|
|
DIRINDEXES
|
Array of values that matches the DIRNAMES with the BASENBAMES
|
|
BASENAMES
|
Array of file base names
|
|
DIRNAMES
|
Array of directories that matches up with BASENAMES
|
OLDFILENAMES tag is used when the files are not compressed, when the REQUIRENAME tag does not indicate rpmlib(CompressedFileNames).
FILESIZES tag specifies the size of each file in the payload, while the FILEMODES tag specifies the file modes (permissions) and the FILEMTIMES tag holds the last modification time for each file.
BASENAMES tag holds an array of the base file names for the files in the payload. The DIRNAMES tag holds an array of the directories for the files. The DIRINDEXES tag contains an index into the DIRNAMES for the directory. Each RPM must have either OLDFILENAMES or the triple of BASENAMES, DIRNAMES, and DIRINDEXES, but not both.
$ rpm -q --qf "[%-15{=NAME} %-36{FILENAMES} %{FILEMODES:perms}\n]" sudo
sudo /etc/pam.d/sudo -rw-r--r--
sudo /etc/pam.d/sudo-i -rw-r--r--
sudo /etc/sudoers -r--r-----
sudo /etc/sudoers.d drwxr-x---
sudo /usr/bin/sudo ---s--x--x
sudo /usr/bin/sudoedit ---s--x--x
sudo /usr/bin/sudoreplay ---x--x--x
sudo /usr/libexec/sesh -rwxr-xr-x
sudo /usr/libexec/sudo_noexec.so -rwxr-xr-x
sudo /usr/sbin/visudo -rwxr-xr-x
sudo /usr/share/doc/sudo-1.7.4p4 drwxr-xr-x
sudo /usr/share/doc/sudo-1.7.4p4/ChangeLog -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/HISTORY -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/LICENSE -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/NEWS -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/README -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/README.LDAP -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/TROUBLESHOOTING -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/UPGRADE -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/sample.pam -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/sample.sudoers -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/sample.syslog.conf -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/schema.ActiveDirectory -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/schema.OpenLDAP -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/schema.iPlanet -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/sudoers.ldap.pod -rw-r--r--
sudo /usr/share/doc/sudo-1.7.4p4/sudoers2ldif -rw-r--r--
sudo /usr/share/man/man5/sudoers.5.gz -rw-r--r--
sudo /usr/share/man/man5/sudoers.ldap.5.gz -rw-r--r--
sudo /usr/share/man/man8/sudo.8.gz -rw-r--r--
sudo /usr/share/man/man8/sudoedit.8.gz -rw-r--r--
sudo /usr/share/man/man8/sudoreplay.8.gz -rw-r--r--
sudo /usr/share/man/man8/visudo.8.gz -rw-r--r--
sudo /var/db/sudo drwx------
|
Tag
|
Holds
|
|
ARCHIVESIZE
|
Uncompressed size of the payload section
|
|
COOKIE
|
Holds an opaque string
|
|
RPMVERSION
|
Holds the version of the RPM tool used to create the package
|
|
OPTFLAGS
|
Compiler optimization flags used to build the package
|
|
PAYLOADFORMAT
|
Must be cpio for LSB-compliant packages
|
|
PAYLOADCOMPRESSOR
|
Must be gzip for LSB-compliant packages
|
|
PAYLOADFLAGS
|
Must be 9 for LSB-compliant packages
|
|
RHNPLATFORM
|
Holds an opaque string
|
|
FILEVERIFYFLAGS
|
Bitmask that specifies which tests to perform to verify the files after an install
|
$ rpm -qp --qf "%{name} - rpm %{rpmversion}\n" *.rpm
qt - rpm 4.7.2
qt - rpm 4.7.2
qt-devel - rpm 4.7.2
qt-mysql - rpm 4.7.2
qt-sqlite - rpm 4.7.2
qt-sqlite - rpm 4.7.2
qt-x11 - rpm 4.7.2
qt-x11 - rpm 4.7.2
|
Option
|
Meaning
|
|
--dump
|
Dumps out extra information on files
|
|
--fileid md5_id
|
Queries for the package with the given MD5 digest
|
|
--hdrid sha1_header_id
|
Queries for the package with the given header identifier number, in SHA1 format
|
|
--last
|
Reorders the output of the rpm command to show the most recently-installed packages first
|
|
--pkgid md5_id
|
Queries for the package with the given MD5 package ID
|
|
--querybynumber number
|
Queries for the given entry, by number, in the RPM database
|
|
--tid transaction_id
|
Queries for the package or packages with the given transaction ID
|
–p option tells the rpm command to provide information on the given package file. The basic syntax is:
rpm –qp query_options filename
--package, in place of –p. You can also pass more than one RPM file to the command.
-q, -p, and -c options with the name of a package file, as shown following:
$ rpm -qpc qt-4.6.2-17.fc12.x86_64.rpm /etc/Trolltech.conf
-q, -p, and -l options (example output truncated):
$ rpm -qpl qt-4.6.2-17.fc12.x86_64.rpm /etc/Trolltech.conf /usr/bin/qdbus /usr/lib64/libQtCore.so.4 /usr/lib64/libQtCore.so.4.6 /usr/lib64/libQtCore.so.4.6.2 /usr/lib64/libQtDBus.so.4 /usr/lib64/libQtDBus.so.4.6 /usr/lib64/libQtDBus.so.4.6.2 /usr/lib64/libQtNetwork.so.4 /usr/lib64/libQtNetwork.so.4.6
rpm -qp ftp://username:password@hostname:port/path/to/rpm/file
rpm -qp http://hostname:port/path/to/rpm/file
|
Network Proxy Option
|
Meaning
|
|
--ftpproxy proxy_hostname
|
Names the proxy system
|
|
--ftpport proxy_port_number
|
Network port number on the proxy system
|
|
--httpproxy proxy_hostname
|
Names the proxy system
|
|
--httpport proxy_port_number
|
Network port number on the proxy system
|
-V (or --verify) option. The rpm -V command will also report missing dependencies.
rpm -V verify_options package_name
rpm -V telnet
#
$ rpm -V telnet-server
missing c /etc/xinetd.d/telnet
missing /usr/sbin/in.telnetd
missing d /usr/share/man/man5/issue.net.5.gz
-a option.
# rpm -Va
SM5....T c /usr/share/info/dir
.......T c /etc/krb5.conf
.......T /usr/share/pixmaps/gnome-default-dlg.png
.......T /usr/share/pixmaps/gnome-error.png
.......T /usr/share/pixmaps/gnome-info.png
.......T /usr/share/pixmaps/gnome-question.png
.......T /usr/share/pixmaps/gnome-warning.png
S.5....T c /etc/sysconfig/pcmcia
.....U.. /dev/winradio0
|
Code
|
Meaning
|
|
S
|
File size differs.
|
|
M
|
File mode differs.
|
|
5
|
The MD5 checksum differs.
|
|
D
|
The major and minor version numbers differ on a device file.
|
|
L
|
A mismatch occurs in a link.
|
|
U
|
The file ownership differs.
|
|
G
|
The file group owner differs.
|
|
T
|
The file time (mtime) differs.
|
|
Option
|
Usage
|
|
--nodeps
|
Don't verify dependencies.
|
|
--nodigest
|
Don't verify the package or header digests.
|
|
--nofiles
|
Don't verify the file attributes.
|
|
--noscripts
|
Don't try to verify the scripts.
|
|
--nosignature
|
Don't verify the package or header signatures.
|
|
--nolinkto
|
Don't verify the link file attribute.
|
|
--nomd5
|
Don't verify the MD5 digest file attribute.
|
|
--nosize
|
Don't verify the file size attribute.
|
|
--nouser
|
Don't verify the file owner attribute.
|
|
--nogroup
|
Don't verify the file group owner attribute.
|
|
--nomtime
|
Don't verify the file mtime attribute.
|
|
--nomode
|
Don't verify the file mode attribute.
|
|
--nordev
|
Don't verify the file rdev attribute.
|
|
-a
|
Verify all packages in a given group.
|
|
-g group
|
Verify all packages in a given group.
|
|
-p file
|
Verify the given RPM file.
|
--nofiles option is often used with –Va to verify the whole system but skip tests of file attributes. This command is used so often it has become an idiom for RPM usage, especially for debugging RPM problems. Run a command like the following:
rpm -Va --nofiles
# file /var/lib/rpm/*
/var/lib/rpm/Basenames: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Conflictname: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/__db.001: data
/var/lib/rpm/__db.002: X11 SNF font data, LSB first
/var/lib/rpm/__db.003: X11 SNF font data, LSB first
/var/lib/rpm/Dirnames: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Filemd5s: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Group: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Installtid: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Name: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Packages: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Providename: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Provideversion: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Requirename: Berkeley DB (Hash, version 7, native byte-order)
/var/lib/rpm/Requireversion: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Sha1header: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Sigmd5: Berkeley DB (Btree, version 8, native byte-order)
/var/lib/rpm/Triggername: Berkeley DB (Hash, version 7, native byte-order)
tar cf rpmdb.tar /var/lib/rpm
--rebuilddb option to tell the rpm command to rebuild your database. For example:
rpm --rebuilddb
Packages in the /var/lib/rpm directory. Only the Packages file is required. All the other files can be recreated from the Packages file. If your database is OK, this command won't do much, other than shrink the size of your RPM database by removing unused entries. This command will take some time to execute, though.
rpm --rebuilddb command has not damaged the RPM database, you can check with a file listing, query all packages, and then check the results of the rpm –rebuilddb command with another file listing when done.
--initdb option to tell the rpm command to create a new empty RPM database. In almost all cases, you do not want to create a new RPM database, since this database will be empty. It will not have any knowledge about the packages you have already installed on your system. That could lead to a lot of problems, since you have the files installed, but the RPM system just doesn’t know about them.
rpm --initdb
--dbpath option to tell the rpm command to create an RPM database in a different directory.
mkdir /tmp/rpm
rpm --initdb --dbpath /tmp/rpm
--rebuilddb option to the rpm command to rebuild a damaged RPM database.
# rpm -e setup
error: Failed dependencies:
setup is needed by (installed) basesystem-10.0-3.noarch
setup >= 2.5.4-1 is needed by (installed) filesystem-2.4.31-1.fc13.x86_64
setup is needed by (installed) shadow-utils-2:4.1.4.2-8.fc13.x86_64
setup is needed by (installed) rpcbind-0.2.0-5.fc13.x86_64
setup >= 2.5.31-1 is needed by (installed) sendmail-8.14.4-4.fc13.x86_64
setup is needed by (installed) xinetd-2:2.3.14-32.fc13.x86_64
setup >= 2.5.48 is needed by (installed) ccache-2.4-18.fc13.x86_64
setup is needed by (installed) dump-1:0.4-0.6.b42.fc13.x86_64
$ ldd /bin/grep
linux-vdso.so.1 => (0x00007fffcb90d000)
libpcre.so.0 => /lib64/libpcre.so.0 (0x000000378ca00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003771000000)
/lib64/ld-linux-x86-64.so.2 (0x0000003770c00000)
rpmbuild for more on building packages.
|
Option
|
Result
|
|
-v
|
increases verbosity of output (can be used multiple times)
|
|
-s server
|
connects to a specific rpmfind database server
|
|
--sources package
|
looks for source RPMs of the package
|
|
--apropos key word(s)
|
looks by keyword instead of package name
|
|
--dist dist
|
restricts packages to a specific distribution
|
|
--latest package
|
finds the most current version of package available
|
|
--upgrade package
|
finds the most current dependencies available for package
|
|
Site
|
Holds
|
|
http://plf.zarb.org/
|
The Penguin Liberation Front has RPMs that for legal reasons cannot be included in the Mandrake Linux distribution.
|
|
www.math.unl.edu/~rdieter/Projects/
|
Rex Dieter’s RPM site
|
|
www.rpmhelp.net/
|
Mandrake Linux RPMs
|
|
www.aucs.org/rpmcenter/
|
Edwin Chan's Red Hat RPMs
|
|
www.owlriver.com/projects/links/
|
Owl River Company RPMs
|
|
Command
|
Usage
|
|
?
|
displays help on the various commands
|
|
Help
|
displays help on the various commands
|
|
Info
|
displays information about an RPM
|
|
Fullinfo
|
displays complete information about an RPM
|
|
Install
|
installs RPMs onto the system
|
|
Add
|
adds RPMs to the queue of RPMs to be processed
|
|
Remove
|
deletes RPMs from the queue of RPMs waiting to be processed
|
|
List
|
displays all RPMs currently in the queue waiting to be processed
|
|
Cd
|
changes the local directory
|
|
Auto
|
executes commands defined in the system-wide configuration file
|
|
Set
|
displays or modifies current AutoRPM settings
|
|
Abort
|
exits without saving changes
|
|
Exit
|
Exits and saves changes
|
|
Command
|
Usage
|
|
autodld
|
downloads updated versions of all installed software
|
|
autoget
|
downloads specific RPMs from remote sites
|
|
autoupd
|
installs more recent versions of currently installed software
|
|
autoins
|
installs specific applications
|
|
automerge
|
merges new RPMs into an existing directory of RPMs, removing any old versions
|
|
autopurge
|
removes old RPMs from an existing directory of RPMs.
|
|
Option
|
Usage
|
|
--configure
|
Start a dialog for configuring up2date options
|
|
-d
|
Download packages but do not install them
|
|
-f
|
Force packages to be installed, even if they have been marked to be skipped
|
|
-i
|
Download and install packages
|
|
-l
|
List available updated versions of already installed packages
|
|
--showall
|
List all available packages, including packages not currently installed at all
|
|
-k
|
List local directories containing packages
|
|
--nosig
|
Disable GPG package signature checking
|
|
--src
|
Download both source and binary RPMs
|
|
--nosrc
|
Do not download source RPMs
|
|
-p
|
Update the list of installed packages associated with this computer in the Red Hat Network database
|
|
--whatprovides
|
Ask the RHN servers which packages will resolve the listed dependencies
|
|
--solvedeps
|
Ask the RHN servers which packages will resolve the listed dependencies, then downloads and installs those packages
|
|
--tmpdir
|
Specify the temporary directory to which packages should be downloaded
|
|
-u
|
Update all software currently installed on the system to the latest available version
|
|
--nox
|
Short for No X, this disables the X-based GUI, instead using only the command-line interface
|
|
-v
|
Provide more verbose output
|
|
Directory
|
Usage
|
|
BUILD
|
The rpmbuild command builds software in this directory.
|
|
RPMS
|
The rpmbuild command stores binary RPMs it creates in this directory.
|
|
SOURCES
|
You should put the sources for the application in this directory.
|
|
SPECS
|
You should place the spec file for each RPM you plan to make in this directory.
|
|
SRPMS
|
The rpmbuild command places source RPMs in this directory.
|
|
Option
|
Usage
|
|
-ba
|
Build all, both a binary and source RPM
|
|
-bb
|
Build a binary RPM
|
|
-bc
|
Build (compile) the program but do not make the full RPM, stopping just after the %build section
|
|
-bp
|
Prepare for building a binary RPM, and stop just after the %prep section
|
|
-bi
|
Create a binary RPM and stop just after the %install section
|
|
-bl
|
Check the listing of files for the RPM and generate errors if the buildroot is missing any of the files to be installed
|
|
-bs
|
Build a source RPM only
|
rpmbuild covers a number of addition options for the rpmbuild command that you can use to customize the build.
|
Directory
|
Usage
|
|
BUILD
|
Where the rpmbuild command builds software
|
|
RPMS
|
Where the rpmbuild command stores binary RPMs it creates
|
|
SOURCES
|
Where you should put the sources for the application
|
|
SPECS
|
Where you should place the spec file
|
|
SRPMS
|
Where the rpmbuild command places source RPMs
|
|
Parameter
|
Usage
|
|
-a number
|
Only unpack the source directive of the given number, such as –a 0 for source0:, after changing to the directory.
|
|
-b number
|
Only unpack the source directive of the given number, such as –b 0 for source0:, before changing to the directory.
|
|
-c
|
Create directory before unpacking, used if your sources will not create the directory as part of unpacking.
|
|
-D
|
Do not delete the directory before unpacking.
|
|
-n name
|
Name the directory as name.
|
|
-q
|
Run quietly with minimal output.
|
|
-T
|
Disable the automatic unpacking of the archives.
|
|
Action
|
Count
|
|
Install the first time
|
1
|
|
Upgrade
|
2 or higher (depending on the number of versions installed)
|
|
Remove last version of package
|
0
|
|
Test
|
Usage
|
|
group
|
Verifies the group of the file
|
|
maj
|
Verifies the file’s major device number
|
|
md5
|
Verifies the file’s MD5 checksum
|
|
min
|
Verifies the file’s minor device number
|
|
mode
|
Verifies the file mode, or permissions
|
|
mtime
|
Verifies the file’s last modification time
|
|
owner
|
Verifies the owner of the file
|
|
size
|
Verifies the file’s size
|
|
symlink
|
Verifies a symbolic link
|
|
Macro
|
Usage
|
|
%dump
|
Prints out macro values
|
|
%{echo:message}
|
Prints message to stderr
|
|
%{error:message}
|
Prints message to stderr and returns BADSPEC
|
|
%{expand:expression}
|
Like eval, expands expression
|
|
%{F:file_exp}
|
Expands file_exp to a file name
|
|
%global name value
|
Defines a global macro
|
|
%{P:patch_exp}
|
Expands patch_exp to a patch file name
|
|
%{S:source_exp}
|
Expands source_exp to a source file name
|
|
%trace
|
Toggles the printing of debugging information
|
|
%{uncompress:filename}
|
Tests if file filename is compressed. If so, uncompresses and includes in the given context. If not compressed, calls cat to include file in given context.
|
|
%undefine macro
|
Undefines the given macro
|
|
%{warn:message}
|
Prints message to stderr
|
|
Macro
|
Holds
|
|
%0
|
The name of the macro
|
|
%*
|
All the parameters to the macro, except for any processed options
|
|
%#
|
The number of parameters
|
|
%1
|
The first parameter
|
|
%2
|
The second parameter
|
|
%3
|
The third parameter, and so on with %4, %5 and beyond
|
|
%{-p}
|
Holds -p if the -p parameter was passed to the macro; otherwise holds nothing
|
|
%{-p*}
|
Holds the value passed with the -p parameter, if the -p parameter was passed to the macro; otherwise holds nothing
|
|
%{-p:text}
|
Holds text if the -p parameter was passed to the macro; otherwise holds nothing
|
|
Comparison
|
Meaning
|
|
package < version
|
A package with a version number less than version
|
|
package > version
|
A package with a version number greater than version
|
|
package >= version
|
A package with a version number greater than or equal to version
|
|
package <= version
|
A package with a version number less than or equal to version
|
|
package = version
|
A package with a version number equal to version
|
|
package
|
A package at any version number
|
rpmbuildrpmbuild command
|
Option
|
Usage
|
|
--buildroot directory
|
Override the default root directory for building with directory, generally not very useful since most packages already name a buildroot
|
|
--clean
|
Remove the build tree after building
|
|
--nobuild
|
Just test the spec file and do not run the build
|
|
--rmsource
|
Remove the sources after the build
|
|
--rmspec
|
Remove the spec file after the build
|
|
--short-circuit
|
With the -bc or -bi options, jump directly to the given stage and resume the build from that stage
|
|
--sign
|
Sign the package with a GPG signature
|
|
--target platform
|
Build for the given platform. May not work if you don't have the other platform build commands, such as cross compilers, set up. Can work for Intel platforms with i386, i686, and so on.
|
|
Option
|
Usage
|
|
-ta
|
Build all, both a binary and source RPM
|
|
-tb
|
Build a binary RPM
|
|
-tc
|
Stop after the %build section
|
|
-tp
|
Stop after the %prep section
|
|
-ti
|
Stop after the %install section
|
|
-tl
|
Check the listing of files for the RPM
|
|
-ts
|
Build a source RPM only
|
|
Option
|
Usage
|
|
--nogpg
|
Don’t check for GPG signatures
|
|
--nomd5
|
Don’t check for MD5 signatures
|
|
--nopgp
|
Don’t check for PGP signatures
|
|
Command
|
Function
|
|
Ctrl+C Tab
|
Adds a new tag to the spec file
|
|
Ctrl+C Ctrl+F F
|
Adds a new file to the %files section
|
|
Ctrl+C Ctrl+F C
|
Adds a new configuration file to the %files section
|
|
Ctrl+C Ctrl+F D
|
Adds a new documentation file to the %files section
|
|
Ctrl+C Ctrl+F G
|
Adds a new ghost file to the %files section
|
|
Ctrl+C Ctrl+D D
|
Adds a new directory to the %files section
|
|
Ctrl+C Ctrl+D O
|
Adds a new documentation directory to the %files section
|
|
Ctrl+C Ctrl+C U
|
Changes the umask in %defattr entries in %files
|
|
Ctrl+C Ctrl+C O
|
Changes the owner in %defattr entries in %files
|
|
Ctrl+C Ctrl+C G
|
Changes the group in %defattr entries in %files
|
rpmbuild covers signing packages.
|
Scripting Languages
|
Programming Languages
|
|
Bash (Bourne Again shell) Csh (C shell) JavaScript Ksh (Korn shell) Lua MS-DOS batch files Perl Python Ruby Sh (Bourne shell) Tcl
|
Assembler BASIC C C++ C# FORTRAN Forth Java LISP Modula-2, Modula-3 Oberon Pascal
|
|
Variable
|
Holds
|
|
$0
|
The name of the script itself, from the command line
|
|
$1
|
The first option
|
|
$2
|
The second option
|
|
$3
|
The third option
|
|
$4
|
The fourth option
|
|
$5
|
The fifth option
|
|
$6
|
The sixth option
|
|
$7
|
The seventh option
|
|
$8
|
The eighth option
|
|
$9
|
The ninth option
|
|
$*
|
All command-line options
|
|
$#
|
Holds the number of command-line options
|
popt for command-line argument processing
|
File
|
Defines
|
|
rpmdb.h
|
RPM database access
|
|
rpmio.h
|
RPM input/output routines
|
|
popt.h
|
Command-line option processing
|
|
File
|
Defines
|
|
rpmts.h
|
Transaction sets
|
|
rpmte.h
|
Transaction elements (packages)
|
|
rpmds.h
|
Dependency sets
|
|
rpmfi.h
|
File information
|
|
header.h
|
Package headers
|
|
Library
|
Usage
|
|
rpm
|
Main RPM library
|
|
rpmdb
|
RPM database library
|
|
rpmio
|
RPM input/output
|
|
popt
|
Command-line option parsing library
|
|
Level
|
Usage
|
|
RPMMESS_FATALERROR
|
Only critical error conditions and above
|
|
RPMMESS_ERROR
|
Only error conditions and above
|
|
RPMMESS_WARNING
|
Only warning conditions and above
|
|
RPMMESS_QUIET
|
Same as RPMMESS_WARNING
|
|
RPMMESS_NORMAL
|
Only significant messages
|
|
RPMMESS_VERBOSE
|
Verbose informational messages
|
|
RPMMESS_DEBUG
|
Debugging messages, and everything above
|
|
Flag
|
Meaning
|
|
POPT_CONTEXT_NO_EXEC
|
Ignore executable expansions
|
|
POPT_CONTEXT_KEEP_FIRST
|
Treat argv[0], the command name, as an option
|
|
POPT_CONTEXT_POSIXMEHARDER
|
Do not allow options to follow arguments
|
|
Type
|
Value
|
Meaning
|
|
POPT_ARG_NONE
|
0
|
No argument data, just the option such as -v
|
|
POPT_ARG_STRING
|
1
|
arg treated as string
|
|
POPT_ARG_INT
|
2
|
arg treated as int
|
|
POPT_ARG_LONG
|
3
|
arg treated as long
|
|
POPT_ARG_INCLUDE_TABLE
|
4
|
arg points to a table
|
|
POPT_ARG_CALLBACK
|
5
|
arg points to a callback function
|
|
POPT_ARG_INTL_DOMAIN
|
6
|
sets translation domain
|
|
POPT_ARG_VAL
|
7
|
use value of val field for arg
|
|
POPT_ARG_FLOAT
|
8
|
arg treated as float
|
|
POPT_ARG_DOUBLE
|
9
|
arg treated as double
|
|
Code
|
Meaning
|
|
POPT_ERROR_NOARG
|
Option requires an argument, but it is missing
|
|
POPT_ERROR_BADOPT
|
Argument could not be parsed
|
|
POPT_ERROR_OPTSTOODEEP
|
Aliases are nested too deeply
|
|
POPT_ERROR_BADQUOTE
|
Start and end quotation marks don't match
|
|
POPT_ERROR_BADNUMBER
|
Argument could not be converted to a number
|
|
POPT_ERROR_OVERFLOW
|
Argument number was too big or too small
|
|
POPT_ERROR_ERRNO
|
A system call returned an error in errno
|
|
Code
|
|
RPMRC_OK
|
|
RPMRC_BADMAGIC
|
|
RPMRC_FAIL
|
|
RPMRC_BADSIZE
|
|
RPMRC_SHORTREAD
|
|
Type
|
Meaning
|
|
RPMMIRE_DEFAULT
|
Same as regular expressions but with \., .*, and ^..$ added.
|
|
RPMMIRE_GLOB
|
Glob-style patterns using fnmatch.
|
|
RPMMIRE_REGEX
|
Regular expressions using regcomp.
|
|
RPMMIRE_STRCMP
|
String comparisons using strcmp.
|
|
Class
|
Covers
|
|
rpm
|
RPM base module into RPM API
|
|
rpmts
|
Transaction sets
|
|
rpmte
|
Transaction elements, a package in a transaction set
|
|
rpmmi
|
Match iterators, used for querying the RPM database
|
|
Rpmds
|
Dependency set
|
|
Rpmfi
|
File into set
|
|
Header
|
A package header
|
import rpm ts = rpm.TransactionSet()
rpm.addMacro("_dbpath", path_to_rpm_database)
# Open the rpmdb-redhat database rpm.addMacro("_dbpath", "/usr/lib/rpmdb/i386-redhat-linux/redhat") solvets = rpm.TransactionSet() solvets.openDB() rpm.delMacro("_dbpath") # Open default database ts = rpm.TransactionSet()
ts.initDB()
ts.rebuildDB()
ts.verifyDB()
import rpm ts = rpm.TransactionSet() mi = ts.dbMatch() for h in mi: # Do something with header object...
import rpm ts = rpm.TransactionSet() mi = ts.dbMatch() while mi: h = mi.next() # Do something with the header object pass
#!/usr/bin/python # Acts like rpm -qa and lists the names of all the installed packages. # Usage: # python rpmqa.py import rpm ts = rpm.TransactionSet() mi = ts.dbMatch() for h in mi: print "%s-%s-%s" % (h['name'], h['version'], h['release'])
$ python rpmqa.py libbonoboui-2.0.1-2 attr-2.0.8-3 dhclient-3.0pl1-9 file-3.37-8 hdparm-5.2-1 ksymoops-2.4.5-1 imlib-1.9.13-9 logwatch-2.6-8 mtr-0.49-7 openssh-clients-3.4p1-2 pax-3.0-4 python-optik-1.3-2 dump-0.4b28-4 sendmail-8.12.5-7 sudo-1.6.6-1 mkbootdisk-1.4.8-1 telnet-0.17-23 usbutils-0.9-7 wvdial-1.53-7 docbook-dtds-1.0-14 urw-fonts-2.0-26 db4-utils-4.0.14-14 libogg-devel-1.0-1
value = h['tag_name']
name = h['name']
name = h[rpm.RPMTAG_NAME]
print "Files:" files = h['FILENAMES'] for name in files: print name
print "Files:" fi = h.fiFromHeader() print fi
print h.dsFromHeader('providename') print h.dsFromHeader('requirename') print h.dsFromHeader('obsoletename') print h.dsFromHeader('conflictname')
h.sprintf("%{tag_name}")
print "Header signature: ", h.sprintf("%{DSAHEADER:pgpsig}") print "%-20s: %s" % ('Installed on', h.sprintf("%{INSTALLTID:date}") )
def nvr(h): return h.sprintf("%{NAME}-%{VERSION}-%{RELEASE}")
mi = ts.dbMatch(tag_name, value)
mi = ts.dbMatch('name', 'sendmail')
#!/usr/bin/python # Acts like rpm -q and lists the N-V-R for installed # packages that match a given name. # Usage: # python rpmq.py package_name import sys import rpm ts = rpm.TransactionSet() mi = ts.dbMatch( 'name', sys.argv[1] ) for h in mi: print "%s-%s-%s" % (h['name'], h['version'], h['release'])
$ python rpmq.py sendmail sendmail-8.12.5-7
#!/usr/bin/python # Lists information on installed package listed on command line. # Usage: # python rpminfo.py package_name import sys import rpm def printEntry(header, label, format, extra): value = header.sprintf(format).strip() print "%-20s: %s %s" % (label, value, extra) def printHeader(h): if h[rpm.RPMTAG_SOURCEPACKAGE]: extra = " source package" else: extra = " binary package" printEntry(h, 'Package', "%{NAME}-%{VERSION}-%{RELEASE}", extra) printEntry(h, 'Group', "%{GROUP}", '') printEntry(h, 'Summary', "%{Summary}", '') printEntry(h, 'Arch-OS-Platform', "%{ARCH}-%{OS}-%{PLATFORM}", '') printEntry(h, 'Vendor', "%{Vendor}", '') printEntry(h, 'URL', "%{URL}", '') printEntry(h, 'Size', "%{Size}", '') printEntry(h, 'Installed on', "%{INSTALLTID:date}", '') print h['description'] print "Files:" fi = h.fiFromHeader() print fi # Dependencies print "Provides:" print h.dsFromHeader('providename') print "Requires:" print h.dsFromHeader('requirename') if h.dsFromHeader('obsoletename'): print "Obsoletes:" print h.dsFromHeader('obsoletename') if h.dsFromHeader('conflictname'): print "Conflicts:" print h.dsFromHeader('conflictname') ts = rpm.TransactionSet() mi = ts.dbMatch( 'name', sys.argv[1] ) for h in mi: printHeader(h)
$ python rpminfo.py jikes Package : jikes-1.18-1 binary package Group : Development/Languages Summary : java source to bytecode compiler Arch-OS-Platform : i386-Linux-(none) Vendor : (none) URL : http://ibm.com/developerworks/opensource/jikes Size : 2853672 Installed on : Mon Dec 2 20:10:13 2002 The IBM Jikes compiler translates Java source files to bytecode. It also supports incremental compilation and automatic makefile generation,and is maintained by the Jikes Project: http://ibm.com/developerworks/opensource/jikes/ Files: /usr/bin/jikes /usr/doc/jikes-1.18/license.htm /usr/man/man1/jikes.1.gz Provides: P jikes P jikes = 1.18-1 Requires: R ld-linux.so.2 R libc.so.6 R libc.so.6(GLIBC_2.0) R libc.so.6(GLIBC_2.1) R libc.so.6(GLIBC_2.1.3) R libm.so.6 R libstdc++-libc6.2-2.so.3
mi.pattern(tag_name, mode, pattern)
|
Type
|
Meaning
|
|
rpm.RPMMIRE_DEFAULT
|
Same as regular expressions, but with \., .*, and ^..$ added
|
|
rpm.RPMMIRE_GLOB
|
Glob-style patterns using fnmatch
|
|
rpm.RPMMIRE_REGEX
|
Regular expressions using regcomp
|
|
rpm.RPMMIRE_STRCMP
|
String comparisons using strcmp
|
import rpm ts = rpm.TransactionSet() mi = ts.dbMatch() mi.pattern('name', rpm.RPMMIRE_GLOB, 'py*' ) for h in mi: # Do something with the header... pass
#!/usr/bin/python # Acts like rpm -q and lists the N-V-R for installed packages # that match a given name using a glob-like syntax # # Usage: # python rpmglob.py "package_fragment*" import sys import rpm ts = rpm.TransactionSet() mi = ts.dbMatch() if not mi: print "No packages found." else: mi.pattern('name', rpm.RPMMIRE_GLOB, sys.argv[1] ) for h in mi: print "%s-%s-%s" % (h['name'], h['version'], h['release'])
$ python rpmglob.py "py*" pyxf86config-0.3.1-2 python-devel-2.2.1-17 pygtk2-devel-1.99.12-7 pygtk2-libglade-1.99.12-7 pygtk2-1.99.12-7 pyOpenSSL-0.5.0.91-1 python-optik-1.3-2 python-docs-2.2.1-17 python-2.2.1-17 python-tools-2.2.1-17
h = ts.hdrFromFdno(fdno)
def readRpmHeader(ts, filename): """ Read an rpm header. """ fd = os.open(filename, os.O_RDONLY) h = ts.hdrFromFdno(fd) os.close(fd) return h ts = rpm.TransactionSet() h = readRpmHeader( ts, 'n-v-r.rpm' )
def readRpmHeader(ts, filename): """ Read an rpm header. """ fd = os.open(filename, os.O_RDONLY) h = None try: h = ts.hdrFromFdno(fd) except rpm.error, e: if str(e) == "public key not available": print str(e) if str(e) == "public key not trusted": print str(e) if str(e) == "error reading package header": print str(e) h = None finally: os.close(fd) return h ts = rpm.TransactionSet() h = readRpmHeader( ts, 'n-v-r.rpm' )
ts.setVSFlags(flags)
# Set to not verify DSA signatures. ts.setVSFlags(rpm.RPMVSF_NODSA)
|
Flag
|
Meaning
|
|
rpm.RPMVSF_NEEDPAYLOAD
|
Leave the file handle positions at the beginning of the payload.
|
|
rpm.RPMVSF_NOHDRCHK
|
Don’t check the RPM database header.
|
|
rpm.RPMVSF_ NODSA
|
Don’t check the header and payload DSA signatures.
|
|
rpm.RPMVSF_ NODSAHEADER
|
Don’t check the header DSA signature.
|
|
rpm.RPMVSF_ NOMD5
|
Don’t check the header and payload MD5 digests.
|
|
rpm.RPMVSF_ NORSA
|
Don’t check the header and payload RSA signatures.
|
|
rpm.RPMVSF_ NOSHA1HEADER
|
Don’t check the header SHA1 digest.
|
|
rpm._RPMVSF_NODIGESTS
|
Convenience to not check digests.
|
|
rpm._RPMVSF_NOSIGNATURES
|
Convenience to not check signatures.
|
ts.setVSFlasgs(-1)
file_h = ts.hdrFromFdno(fd) file_ds = file_h.dsOfHeader() inst_ds = inst_h.dsOfHeader() if file_ds.EVR() >= inst_ds.EVR(): print "Package file is same or newer, OK to upgrade." else: print "Package file is older than installed version."
#!/usr/bin/python # Reads in package header, compares to installed package. # Usage: # python vercompare.py rpm_file.rpm # import os import sys import rpm def readRpmHeader(ts, filename): """ Read an rpm header. """ fd = os.open(filename, os.O_RDONLY) try: h = ts.hdrFromFdno(fd) finally: os.close(fd) return h ts = rpm.TransactionSet() h = readRpmHeader( ts, sys.argv[1] ) pkg_ds = h.dsOfHeader() for inst_h in ts.dbMatch('name', h['name']): inst_ds = inst_h.dsOfHeader() if pkg_ds.EVR() >= inst_ds.EVR(): print "Package file is same or newer, OK to upgrade." else: print "Package file is older than installed version."
ts.addInstall(header, key_data, mode)
ts.addErase(package_name)
h = readRpmHeader( ts, sys.argv[1] ) ts.addInstall(h, sys.argv[1], 'u')
|
Method
|
Returns
|
|
A
|
Returns package architecture
|
|
E
|
Returns package epoch
|
|
O
|
Returns package operating system
|
|
R
|
Returns package release number
|
|
V
|
Returns package version
|
|
N
|
Returns package name
|
|
NEVR
|
Returns package name-epoch-version-release
|
|
DS
|
Returns the package dependency set for a given tag
|
|
FI
|
Returns the file info set for the package
|
ds = te.DS(tag_name)
ds = te.DS('Requirename')
fi = te.FI(tag_name)
#!/usr/bin/python # Adds all package files on command line to a transaction # and prints out the transaction elements. # Usage: # python te.py rpm_file1.rpm rpm_file2.rpm ... # import os import sys import rpm def readRpmHeader(ts, filename): """ Read an rpm header. """ fd = os.open(filename, os.O_RDONLY) try: h = ts.hdrFromFdno(fd) finally: os.close(fd) return h ts = rpm.TransactionSet() # Set to not verify DSA signatures. ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) for filename in sys.argv[1:]: h = readRpmHeader(ts, filename) print "Installing %s-%s-%s" % (h['name'], h['version'], h['release']) ts.addInstall(h, filename, 'i') print "This will install:" for te in ts: print "%s-%s-%s" % (te.N(), te.V(), te.R() ) ts.check() ts.order() print "This will install:" for te in ts: print "%s-%s-%s" % (te.N(), te.V(), te.R() )
unresolved_dependencies = ts.check()
((N,V,R), (reqN, reqV), needsFlags, suggestedPackage, sense)
(('eruby-devel', '0.9.8', '2'), ('eruby-libs', '0.9.8'), 8, None, 0)
(('jpilot', '0.97', '1'), ('libpisock.so.3', None), 0, None, 0)
def checkCallback(ts, TagN, N, EVR, Flags): # Do something... pass
def checkCallback(ts, TagN, N, EVR, Flags): if TagN == rpm.RPMTAG_REQUIRENAME: prev = "" Nh = None if N[0] == '/': dbitag = 'basenames' else: dbitag = 'providename' # What do you need to do. if EVR: print "Must find package [", N, "-", EVR, "]" else: print "Must find file [", N, "]" if resolved: # ts.addIntall(h, h, 'i') return -1 return 1
ts.run(callback, client_data)
def runCallback(reason, amount, total, key, client_data): # Do your stuff... pass
|
Value
|
Reason
|
|
rpm.RPMCALLBACK_UNKNOWN
|
Unknown problem
|
|
rpm.RPMCALLBACK_INST_PROGRESS
|
Progress for installation
|
|
rpm.RPMCALLBACK_INST_START
|
Start of installation
|
|
rpm.RPMCALLBACK_INST_OPEN_FILE
|
Callback should open package file
|
|
rpm.RPMCALLBACK_INST_CLOSE_FILE
|
Callback should close package file
|
|
rpm.RPMCALLBACK_TRANS_PROGRESS
|
Transaction progress
|
|
rpm.RPMCALLBACK_TRANS_START
|
Transaction start
|
|
rpm.RPMCALLBACK_TRANS_STOP
|
Transaction stop
|
|
rpm.RPMCALLBACK_UNINST_PROGRESS
|
Uninstallation progress
|
|
rpm.RPMCALLBACK_UNINST_START
|
Uninstallation start
|
|
rpm.RPMCALLBACK_UNINST_STOP
|
Uninstallation stop
|
|
rpm.RPMCALLBACK_REPACKAGE_PROGRESS
|
Repackaging progress
|
|
rpm.RPMCALLBACK_REPACKAGE_START
|
Repackaging start
|
|
rpm.RPMCALLBACK_REPACKAGE_STOP
|
Repackaging stop
|
|
rpm.RPMCALLBACK_UNPACK_ERROR
|
Error unpacking package file
|
|
rpm.RPMCALLBACK_CPIO_ERROR
|
cpio error getting package payload
|
# Global file descriptor for the callback. rpmtsCallback_fd = None def runCallback(reason, amount, total, key, client_data): global rpmtsCallback_fd if reason == rpm.RPMCALLBACK_INST_OPEN_FILE: print "Opening file. ", reason, amount, total, key, client_data rpmtsCallback_fd = os.open(client_data, os.O_RDONLY) return rpmtsCallback_fd elif reason == rpm.RPMCALLBACK_INST_START: print "Closing file. ", reason, amount, total, key, client_data os.close(rpmtsCallback_fd)
#!/usr/bin/python # Upgrades packages passed on the command line. # Usage: # python rpmupgrade.py rpm_file1.rpm rpm_file2.rpm ... # import os import sys import rpm # Global file descriptor for the callback. rpmtsCallback_fd = None def runCallback(reason, amount, total, key, client_data): global rpmtsCallback_fd if reason == rpm.RPMCALLBACK_INST_OPEN_FILE: print "Opening file. ", reason, amount, total, key, client_data rpmtsCallback_fd = os.open(key, os.O_RDONLY) return rpmtsCallback_fd elif reason == rpm.RPMCALLBACK_INST_START: print "Closing file. ", reason, amount, total, key, client_data os.close(rpmtsCallback_fd) def checkCallback(ts, TagN, N, EVR, Flags): if TagN == rpm.RPMTAG_REQUIRENAME: prev = "" Nh = None if N[0] == '/': dbitag = 'basenames' else: dbitag = 'providename' # What do you need to do. if EVR: print "Must find package [", N, "-", EVR, "]" else: print "Must find file [", N, "]" if resolved: # ts.addIntall(h, h, 'i') return -1 return 1 def readRpmHeader(ts, filename): """ Read an rpm header. """ fd = os.open(filename, os.O_RDONLY) try: h = ts.hdrFromFdno(fd) finally: os.close(fd) return h ts = rpm.TransactionSet() # Set to not verify DSA signatures. ts.setVSFlags(-1) for filename in sys.argv[1:]: h = readRpmHeader(ts, filename) print "Upgrading %s-%s-%s" % (h['name'], h['version'], h['release']) ts.addInstall(h, filename, 'u') unresolved_dependencies = ts.check(checkCallback) if not unresolved_dependencies: ts.order() print "This upgrade will install:" for te in ts: print "%s-%s-%s" % (te.N(), te.V(), te.R()) print "Running transaction (final step)..." ts.run(runCallback, 1) else: print "Error: Unresolved dependencies, transaction failed." print unresolved_dependencies
# rpm -q jikes jikes-1.17-1 # python rpmupgrade.py jikes-1.18-1.i386.rpm Upgrading jikes-1.18-1 This upgrade will install: jikes-1.18-1 jikes-1.17-1 Running transaction (final step)... Opening file. 4 0 0 jikes-1.18-1.i386.rpm 1 Closing file. 2 0 2854204 jikes-1.18-1.i386.rpm 1 # rpm -q jikes jikes-1.18-1
$ python rpmupgrade.py jikes-1.18-1.i386.rpm Upgrading jikes-1.18-1 This upgrade will install: jikes-1.18-1 jikes-1.17-1 Running transaction (final step)... error: cannot get exclusive lock on /var/lib/rpm/Packages error: cannot open Packages index using db3 - Operation not permitted (1) error: cannot open Packages database in /var/lib/rpm
# python rpmupgrade.py jikes-1.17-glibc2.2-1.i386.rpm jpilot-0_97-1_i386.rpm
Upgrading jikes-1.17-1
Upgrading jpilot-0.97-1
Must find file [ libpisock.so.3 ]
Error: Unresolved dependencies, transaction failed.
(('jpilot', '0.97', '1'), ('libpisock.so.3', None), 0, None, 0)
# python rpmupgrade.py eruby-devel-0.9.8-2.i386.rpm
Upgrading eruby-devel-0.9.8-2
Must find package [ eruby-libs - 0.9.8 ]
Error: Unresolved dependencies, transaction failed.
(('eruby-devel', '0.9.8', '2'), ('eruby-libs', '0.9.8'), 8, None, 0)
|
Routine
|
Usage
|
|
find_all()
|
Returns a list with all the packages in the database
|
|
find_all_iter()
|
Returns an iterator over all the packages in the database
|
|
find_by_file($filename)
|
Finds all packages that own the given file, returning a list
|
|
find_by_file_iter($filename)
|
Finds all packages that own the given file, returning an iterator
|
|
find_by_name($package_name)
|
Finds all packages with the given name, returning a list
|
|
find_by_name_iter($package_name)
|
Finds all packages with the given name, returning an iterator
|
|
find_by_provides($capability)
|
Finds all packages that provide the given capability, returning a list
|
|
find_by_provides_iter($capability)
|
Finds all packages that provide the given capability, returning an iterator
|
|
find_by_requires($capability)
|
Finds all packages that require the given capability, returning a list
|
|
find_by_requires_iter($capability)
|
Finds all packages that require the given capability, returning an iterator
|
|
Platform
|
Notes
|
|
AIX
|
|
|
AmigaOS
|
With GeekGadgets
|
|
BeOS
|
With GeekGadgets
|
|
FreeBSD
|
|
|
HP-UX
|
10.20+, 9.04
|
|
IRIX
|
|
|
Linux
|
Multiple platforms including Alpha, Intel, Motorola 68000, SGI MIPS, PowerPC, and SPARC
|
|
LynxOS
|
|
|
MachTen
|
|
|
MacOS X
|
|
|
Mint
|
|
|
NCS System V
|
|
|
NetBSD
|
|
|
OS/2
|
|
|
OSF/1
|
3.2+
|
|
SCO OpenServer
|
5.0.2+
|
|
Sinix
|
|
|
Solaris
|
Solaris for SPARC 2.4 and 8+, Solaris for Intel
|
|
SunOS 4.1.3
|
|
|
Windows
|
Under Cygwin
|
|
Library
|
Purpose
|
|
Berkeley DB
|
RPM database, using db1 and db3
|
|
bzip2
|
Compression
|
|
gettext
|
International text lookup
|
|
gpg
|
For digital signatures
|
|
gzip
|
Compression
|
|
popt
|
Processing command-line options
|
|
zlib
|
Compression
|
|
Tool
|
Usage
|
|
Autoconf
|
Builds configure scripts
|
|
Automake
|
Used with autoconf
|
|
GNU make
|
Used to control building the sources
|
|
Libtool
|
Used by the autogen.sh script
|
rpmbuild for more on using the --target option to the rpmbuild command.
|
Option
|
Holds
|
|
%0
|
The name of the macro
|
|
%1
|
The first argument, after processing with getopt
|
|
%2-%9
|
Additional arguments
|
|
%*
|
All arguments, except for flags that have been processed
|
|
%#
|
Number of arguments
|
|
File
|
Usage
|
|
/usr/lib/rpm/macros
|
Official RPM macros
|
|
/etc/rpm/macros
|
Per-system customizations
|
|
$HOME/.rpmmacros
|
Per-user customizations
|
|
File
|
Holds
|
|
/usr/lib/rpm/rpmrc
|
RPM standard settings
|
|
/etc/rpm/rpmrc
|
Per-system configuration
|
|
$HOME/.rpmrc
|
Per-user configuration
|
|
Option
|
Usage
|
|
-a, --all
|
Query all packages
|
|
-c, --configfiles
|
List configuration files
|
|
--changelog
|
List changelog entries
|
|
--conflicts
|
List capabilities this package conflicts with
|
|
-d, --docfiles
|
List documentation files
|
|
--dump
|
Dump out extra information on files.
|
|
-f, --file filename
|
Query for packages owning given file
|
|
--filesbypapkg
|
List all files in each selected package
|
|
--fileid md5_id
|
Query for the package with the given MD5 digest
|
|
-g, --group group_name
|
Query packages in the given group
|
|
--hdrid sha1_header_id
|
Query for the package with the given header identifier number, in SHA1 format
|
|
-i, --info
|
Display a lot of package information including description
|
|
--last
|
Reorder the output of the rpm command to show the most recently installed packages first
|
|
--obsoletes
|
List capabilities this package obsoletes
|
|
-p, --package rpm_file
|
Query the given package file or files
|
|
--pkgid md5_id
|
Query for the package with the given MD5 package ID
|
|
--provides
|
List capabilities provided by package
|
|
--querybynumber number
|
Query for the given entry, by number, in the RPM database
|
|
--qf, --queryformat format
|
Use the given query format for displaying the output
|
|
--redhatprovides capability
|
Look in rpmdb-redhat database for packages that provide the given capability
|
|
--redhatrequires capability
|
Look in rpmdb-redhat database for packages that require the given capability
|
|
-R, --requires
|
Lists packages and capabilities that this package depends on
|
|
--specfile specfile
|
Query the given spec file
|
|
-s, --state
|
Display the state of the listed files
|
|
--scripts
|
List scripts in the package
|
|
--tid transaction_id
|
Query for the package or packages with the given transaction ID
|
|
--triggeredby package
|
Query packages triggered by the given package
|
|
--triggers, --triggerscripts
|
List trigger scripts
|
|
--whatrequires capability
|
Query packages that require the given capability
|
|
--whatprovides capability
|
List packages that provide the given capability
|
|
Option
|
Usage
|
|
--aid
|
Add any suggested packages to the list to install or upgrade
|
|
--allfiles
|
Install all the files, even if some might otherwise be skipped
|
|
--badreloc
|
Relocate files even if the package is not relocatable
|
|
--excludedocs
|
Skip the files marked as documentation
|
|
--excludepath path
|
Skip files that begin with path
|
|
--force
|
A short hand for --replacepkgs and --replacefiles
|
|
-h, --hash
|
Print hash marks, #, periodically while performing operation to provide some feedback
|
|
--ignorearch
|
Ignore the architecture listed in the package
|
|
--ignoreos
|
Ignore the operating system listed in the package
|
|
--ignoresize
|
Skip the check to see if there is enough disk space to install the package
|
|
--includedocs
|
Install files marked as documentation, turned on by default
|
|
--justdb
|
Just update the RPM database, do not modify any files
|
|
--nodeps
|
Skip verification of package dependencies
|
|
--nodigest
|
Skip verification of package and header digests
|
|
--nomd5
|
Skip verification of file MD5 checksums
|
|
--noorder
|
Do not reorder the list of packages to be installed based on dependencies
|
|
--nopost
|
Do not run post-install scripts
|
|
--nopostun
|
Do not run post-uninstall scripts
|
|
--nopre
|
Do not run pre-install scripts
|
|
--nopreun
|
Do not run pre-uninstall scripts
|
|
--nosuggest
|
Do not suggest packages for missing dependencies
|
|
--noscripts
|
Do not execute scripts
|
|
--nosignature
|
Skip verification of package and header signatures
|
|
--notriggers
|
Do not execute trigger scripts
|
|
--notriggerin
|
Do not run trigger install scripts
|
|
--notriggerpostun
|
Do not run trigger post uninstall scripts
|
|
--notriggerun
|
Do not run trigger uninstall scripts
|
|
--oldpackage
|
Allow an upgrade to an older version of a package
|
|
--percent
|
Print out percentage of work completed as command executes
|
|
--prefix directory
|
Relocate package to directory, if package is relocatable
|
|
--relocate old=new
|
Relocate all paths that start with old to new, if relocatable
|
|
--repackage
|
Create a package from any files that would be erased
|
|
--replacefiles
|
Install package even if it replaces files from other packages
|
|
--replacepkgs
|
Install packages even if they are already installed
|
|
--test
|
Do not install or remove packages, just see if the command would work
|
|
Option
|
Usage
|
|
--allmatches
|
Remove all versions of the packages; normally an error would occur if there is more than one package of the same name and you try to erase the package
|
|
--nodeps
|
Skip verification of package dependencies
|
|
--noscripts
|
Do not execute scripts
|
|
--nopostun
|
Do not run post-uninstall scripts
|
|
--nopreun
|
Do not run pre-uninstall scripts
|
|
--notriggers
|
Do not execute trigger scripts
|
|
--notriggerpostun
|
Do not run trigger post uninstall scripts
|
|
--notriggerun
|
Do not run trigger uninstall scripts
|
|
--repackage
|
Create a package from any files that would be erased
|
|
--test
|
Do not install or remove packages, just see if the command would work
|
|
Option
|
Usage
|
|
--addsign
|
Sign packages, same as --resign
|
|
--import public_key
|
Add given public key to the RPM database
|
|
--nodigest
|
Skip verification of package and header digests
|
|
--nosignature
|
Skip verification of package and header signatures
|
|
--resign
|
Sign packages
|
|
Option
|
Usage
|
|
-a, --all
|
Verify all packages
|
|
-f, --file filename
|
Verify packages owning given file
|
|
-g, --group group_name
|
Verify packages in the given group
|
|
--nodeps
|
Skip verification of package dependencies
|
|
--nodigest
|
Skip verification of package and header digests
|
|
--nofiles
|
Do not verify the files in the package
|
|
--nogroup
|
Do not verify the group owner
|
|
--nolinkto
|
Do not verify the link file attribute
|
|
--nomd5
|
Skip verification of file MD5 checksums
|
|
--nomtime
|
Do not verify the mtime attribute
|
|
--nomode
|
Do not verify the file mode (permissions)
|
|
--nordev
|
Do not verify the rdev attribute
|
|
--noscripts
|
Do not execute the verify scripts
|
|
--nosignature
|
Skip verification of package and header signatures
|
|
--nosize
|
Do not verify the file size
|
|
--nouser
|
Do not verify the owner of the file
|
|
-p, --package rpm_file
|
Verify the given package file or files
|
|
--specfile specfile
|
Verify the given spec file
|
|
--whatrequires capability
|
Verify packages that require the given capability
|
|
--whatprovides capability
|
Verify packages that provide the given capability
|
|
Option
|
Usage
|
|
--initdb
|
Initialize database
|
|
--rebuilddb
|
Rebuild all the inverted lists from the Packages file
|
|
Option
|
Usage
|
|
-?, --help
|
Print the popt help information for all the command-line options
|
|
--dbpath path_to_rpm_db
|
Use the given directory for the RPM database, instead of the default
|
|
-D, --define 'macro value'
|
Define the given macro to hold the given value
|
|
-E, --eval expression
|
Print the evaluation of the given expression
|
|
--ftpport port
|
Use the given port number for FTP access
|
|
--ftpproxy host
|
Use the given host name as a proxy for FTP access
|
|
--httpport port
|
Use the given port number for HTTP access
|
|
--httpproxy host
|
Use the given host name as a proxy for HTTP access
|
|
--macros file:file:file
|
Read the given colon-separated files as the macro files to define RPM macros; only the first file must exist
|
|
--pipe command
|
Pipe the output of the rpm command to the given command
|
|
--querytags
|
Print the query tag names and exit
|
|
--quiet
|
Provide less output, normally show only errors
|
|
--rcfile file:file:file
|
Read the given colon-separated files as the rc files to define RPM settings; only the first file must exist
|
|
--root directory
|
Use directory as the top-level directory instead of /.
|
|
--showrc
|
Print the rpmrc and macro configuration and exit
|
|
-v, --verbose
|
Provide more verbose output
|
|
-vv
|
Provide even more verbose output, including debugging information
|
|
--version
|
Print the RPM version and exit
|
|
Option
|
Usage
|
|
-ba
|
Build all, both a binary and source RPM
|
|
-bb
|
Build a binary RPM
|
|
-bc
|
Build (compile) the program but do not make the full RPM, by executing the build commands through the %build section and stopping
|
|
-bp
|
Prepare for building a binary RPM, by executing the build commands through the %prep section and stopping
|
|
-bi
|
Execute the build commands through the %install section and stop
|
|
-bl
|
Check the listing of files for the RPM
|
|
-bs
|
Build a source RPM only
|
|
Option
|
Usage
|
|
-ta
|
Build all, both a binary and source RPM
|
|
-tb
|
Build a binary RPM
|
|
-tc
|
Build (compile) the program but do not make the full RPM, by executing the build commands through the %build section and stopping
|
|
-tp
|
Prepare for building a binary RPM, by executing the build commands through the %prep section and stopping
|
|
-ti
|
Execute the build commands through the %install section and stop
|
|
-tl
|
Check the listing of files for the RPM
|
|
-ts
|
Build a source RPM only
|
|
Option
|
Usage
|
|
--rebuild
|
Rebuild binary RPM from source RPM
|
|
--recompile
|
Recompile binary RPM from source RPM
|
|
Option
|
Usage
|
|
-?, --help
|
Print the popt help information for all the command-line options
|
|
--buildroot directory
|
Override the default root directory for building with directory.
|
|
--clean
|
Remove the build tree after building
|
|
-D, --define 'macro value'
|
Define the given macro to hold the given value
|
|
--dbpath path_to_rpm_db
|
Use the given directory for the RPM database instead of the default
|
|
-E, --eval expression
|
Print the evaluation of the given expression
|
|
--macros file:file:file
|
Read the given colon-separated files as the macro files to define RPM macros; only the first file must exist
|
|
--nobuild
|
Don't really build anything, which really tests the spec file
|
|
--pipe command
|
Pipe the output of the rpm command to the given command
|
|
--quiet
|
Provide less output, normally show only errors
|
|
--rcfile file:file:file
|
Read the given colon-separated files as the rc files to define RPM settings; only the first file must exist
|
|
--rmsource
|
Remove the sources after the build
|
|
--rmspec
|
Remove the spec file after the build
|
|
--root directory
|
Use directory as the top-level directory instead of /
|
|
--short-circuit
|
With the -bc or -bi options, jumps directly to the given stage and just executes that stage
|
|
--showrc
|
Print the rpmrc and macro configuration and exit
|
|
--sign
|
Sign the package with a GPG signature
|
|
--target platform
|
Build for the given platform. May not work if you don't have the other platform build commands, such as cross compilers, set up. Can work for Intel platforms with i386, i686, and so on.
|
|
-v, --verbose
|
Provide more verbose output
|
|
-vv
|
Provide even more verbose output, including debugging information
|
|
--version
|
Print the RPM version and exit
|
|
Macro
|
Usage
|
|
%dump
|
Prints out macro values
|
|
%{echo:message}
|
Prints message to stderr
|
|
%{error:message}
|
Prints message to stderr and returns BADSPEC
|
|
%{expand:expression}
|
Like eval, expands expression
|
|
%{F:file_exp}
|
Expands file_exp to a file name
|
|
%global name value
|
Defines a global macro
|
|
%{P:patch_exp}
|
Expands patch_exp to a patch file name
|
|
%{S:source_exp}
|
Expands source_exp to a source file name
|
|
%trace
|
Toggles the printing of debugging information
|
|
%{uncompress:filename}
|
Tests if file filename is compressed. If so, uncompresses and includes in the given context. If not compressed, calls cat to include file in given context.
|
|
%undefine macro
|
Undefines the given macro
|
|
%{warn:message}
|
Prints message to stderr
|
rpmbuild.
|
Constant
|
Value
|
Size in Bytes
|
|
RPM_NULL_TYPE
|
0
|
No size
|
|
RPM_CHAR_TYPE
|
1
|
1
|
|
RPM_INT8_TYPE
|
2
|
1
|
|
RPM_INT16_TYPE
|
3
|
2
|
|
RPM_INT32_TYPE
|
4
|
4
|
|
RPM_INT64_TYPE
|
5
|
Not supported yet
|
|
RPM_STRING_TYPE
|
6
|
Variable number of bytes, terminated by a NULL
|
|
RPM_BIN_TYPE
|
7
|
1
|
|
RPM_STRING_ARRAY_TYPE
|
8
|
Variable, vector of NULL-terminated strings
|
|
RPM_I18NSTRING_TYPE
|
9
|
Variable, vector of NULL-terminated strings
|
|
Constant
|
Value
|
Type
|
Required?
|
|
RPMTAG_NAME
|
1000
|
STRING
|
Yes
|
|
RPMTAG_VERSION
|
1001
|
STRING
|
Yes
|
|
RPMTAG_RELEASE
|
1002
|
STRING
|
Yes
|
|
RPMTAG_SUMMARY
|
1004
|
I18NSTRING
|
Yes
|
|
RPMTAG_DESCRIPTION
|
1005
|
I18NSTRING
|
Yes
|
|
RPMTAG_BUILDTIME
|
1006
|
INT32
|
Optional
|
|
RPMTAG_BUILDHOST
|
1007
|
STRING
|
Optional
|
|
RPMTAG_SIZE
|
1009
|
INT32
|
Yes
|
|
RPMTAG_LICENSE
|
1014
|
STRING
|
Yes
|
|
RPMTAG_GROUP
|
1016
|
I18NSTRING
|
Yes
|
|
RPMTAG_OS
|
1021
|
STRING
|
Yes
|
|
RPMTAG_ARCH
|
1022
|
STRING
|
Yes
|
|
RPMTAG_SOURCERPM
|
1044
|
STRING
|
Optional
|
|
RPMTAG_FILEVERIFYFLAGS
|
1045
|
INT32
|
Optional
|
|
RPMTAG_ARCHIVESIZE
|
1046
|
INT32
|
Optional
|
|
RPMTAG_RPMVERSION
|
1064
|
STRING
|
Optional
|
|
RPMTAG_CHANGELOGTIME
|
1080
|
INT32
|
Optional
|
|
RPMTAG_CHANGELOGNAME
|
1081
|
STRING_ARRAY
|
Optional
|
|
RPMTAG_CHANGELOGTEXT
|
1082
|
STRING_ARRAY
|
Optional
|
|
RPMTAG_COOKIE
|
1094
|
STRING
|
Optional
|
|
RPMTAG_OPTFLAGS
|
1122
|
STRING
|
Optional
|
|
RPMTAG_PAYLOADFORMAT
|
1124
|
STRING
|
Yes
|
|
RPMTAG_PAYLOADCOMPRESSOR
|
1125
|
STRING
|
Yes
|
|
RPMTAG_PAYLOADFLAGS
|
1126
|
STRING
|
Yes
|
|
RPMTAG_RHNPLATFORM
|
1131
|
STRING
|
Deprecated
|
|
RPMTAG_PLATFORM
|
1132
|
STRING
|
Optional
|
|
Constant
|
Value
|
Type
|
Required?
|
|
RPMTAG_HEADERSIGNATURES
|
62
|
BIN
|
Optional
|
|
RPMTAG_HEADERIMMUTABLE
|
63
|
BIN
|
Optional
|
|
RPMTAG_HEADERI18NTABLE
|
100
|
STRING_ARRAY
|
Yes
|
|
Constant
|
Value
|
Type
|
Required?
|
|
SIGTAG_SIGSIZE
|
1000
|
INT32
|
Yes
|
|
SIGTAG_PGP
|
1002
|
BIN
|
Optional
|
|
SIGTAG_MD5
|
1004
|
BIN
|
Yes
|
|
SIGTAG_GPG
|
1005
|
BIN
|
Optional
|
|
SIGTAG_PAYLOADSIZE
|
1007
|
INT32
|
Optional
|
|
SIGTAG_SHA1HEADER
|
1010
|
STRING
|
Optional
|
|
SIGTAG_DSAHEADER
|
1011
|
BIN
|
Optional
|
|
SIGTAG_RSAHEADER
|
1012
|
BIN
|
Optional
|
|
Constant
|
Value
|
Type
|
Required?
|
|
RPMTAG_PREINPROG
|
1085
|
STRING
|
Optional
|
|
RPMTAG_POSTINPROG
|
1086
|
STRING
|
Optional
|
|
RPMTAG_PREUNPROG
|
1087
|
STRING
|
Optional
|
|
RPMTAG_POSTUNPROG
|
1088
|
STRING
|
Optional
|
|
Constant
|
Value
|
Type
|
Required?
|
|
RPMTAG_OLDFILENAMES
|
1027
|
STRING_ARRAY
|
Optional
|
|
RPMTAG_FILESIZES
|
1028
|
INT32
|
Yes
|
|
RPMTAG_FILEMODES
|
1030
|
INT16
|
Yes
|
|
RPMTAG_FILERDEVS
|
1033
|
INT16
|
Yes
|
|
RPMTAG_FILEMTIMES
|
1034
|
INT32
|
Yes
|
|
RPMTAG_FILEMD5S
|
1035
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_FILELINKTOS
|
1036
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_FILEFLAGS
|
1037
|
INT32
|
Yes
|
|
RPMTAG_FILEUSERNAME
|
1039
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_FILEGROUPNAME
|
1040
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_FILEDEVICES
|
1095
|
INT32
|
Yes
|
|
RPMTAG_FILEINODES
|
1096
|
INT32
|
Yes
|
|
RPMTAG_FILELANGS
|
1097
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_DIRINDEXES
|
1116
|
INT32
|
Optional
|
|
RPMTAG_BASENAMES
|
1117
|
STRING_ARRAY
|
Optional
|
|
RPMTAG_DIRNAMES
|
1118
|
STRING_ARRAY
|
Optional
|
|
Constant
|
Value
|
Type
|
Required?
|
|
RPMTAG_PROVIDENAME
|
1047
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_REQUIREFLAGS
|
1048
|
INT32
|
Yes
|
|
RPMTAG_REQUIRENAME
|
1049
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_REQUIREVERSION
|
1050
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_CONFLICTFLAGS
|
1053
|
INT32
|
Optional
|
|
RPMTAG_CONFLICTNAME
|
1054
|
STRING_ARRAY
|
Optional
|
|
RPMTAG_CONFLICTVERSION
|
1055
|
STRING_ARRAY
|
Optional
|
|
RPMTAG_OBSOLETENAME
|
1090
|
STRING_ARRAY
|
Optional
|
|
RPMTAG_PROVIDEFLAGS
|
1112
|
INT32
|
Yes
|
|
RPMTAG_PROVIDEVERSION
|
1113
|
STRING_ARRAY
|
Yes
|
|
RPMTAG_OBSOLETEFLAGS
|
1114
|
INT32
|
Optional
|
|
RPMTAG_OBSOLETEVERSION
|
1115
|
INT32
|
Optional
|
|
Flag
|
Value
|
|
RPMSENSE_LESS
|
0x02
|
|
RPMSENSE_GREATER
|
0x04
|
|
RPMSENSE_EQUAL
|
0x08
|
|
RPMSENSE_PREREQ
|
0x40
|
|
RPMSENSE_INTERP
|
0x100
|
|
RPMSENSE_SCRIPT_PRE
|
0x200
|
|
RPMSENSE_SCRIPT_POST
|
0x400
|
|
RPMSENSE_SCRIPT_PREUN
|
0x800
|
|
RPMSENSE_SCRIPT_POSTUN
|
0x1000
|
|
Name
|
Version
|
Specifies
|
|
Lsb
|
1.3
|
The package conforms to the Linux Standards Base RPM format.
|
|
rpmlib(VersionedDependencies)
|
3.0.3-1
|
The package holds dependencies or prerequisites that have versions associated with them.
|
|
rpmlib(PayloadFilesHavePrefix)
|
4.0-1
|
File names in the archive have a “.” prepended on the names.
|
|
rpmlib(CompressedFileNames)
|
3.0.4-1
|
The package uses the RPMTAG_DIRINDEXES, RPMTAG_DIRNAME and RPMTAG_BASENAMES tags for specifying file names.
|
|
/bin/sh
|
NA
|
Indicates a requirement for the Bourne shell to run the installation scripts.
|
|
Element
|
Holds
|
|
cpio header
|
Information on the file, such as the file mode (permissions)
|
|
File name
|
NULL-terminated string
|
|
Padding
|
0 to 3 bytes, as needed, to align the next element on a 4-byte boundary
|
|
File data
|
The contents of the file
|
|
Padding
|
0 to 3 bytes, as needed, to align the next file record on a 4-byte boundary
|
|
Link
|
Holds
|
|
ftp://ftp.rpm.org/pub/rpm/dist/
|
RPM software downloads
|
|
ftp://ftp.rpm.org/pub/
|
rpm.org download site
|
|
www.rpm.org/cvs_help/
|
Instructions for accessing the RPM CVS repository
|
|
www.rpm.org/hintskinks/
|
Tips for working with RPM
|
|
www.rpm.org/hintskinks/bootstrap/
|
Good tips on bootstrapping RPM to new platforms
|
|
www.rpm.org/howto/
|
How-to documents for working with RPM
|
|
www.rpm.org/max-rpm/
|
Maximum RPM by Edward C. Bailey
|
|
www.rpm.org/RPM-HOWTO/
|
Good introductory tutorial
|
|
www.rpm.org/rpmapi-4.1/
|
API documentation
|
|
Site
|
Holds
|
|
rpmfind.net
|
Links to a huge number of RPMs, many specific to various Linux distributions
|
|
http://rpm.pbone.net/
|
RPM PBone search, useful for finding RPMs
|
|
www.rpm.org/packagers/
|
Lists a number of sites that provide RPMs for download
|
|
www.javapackage.org
|
Many Java packages in RPM format
|
|
http://plf.zarb.org/
|
The Penguin Liberation Front has RPMs that for legal reasons cannot be included in the Mandrake Linux distribution.
|
|
www.math.unl.edu/~rdieter/Projects
|
Rex Dieter’s RPM site
|
|
www.rpmhelp.net
|
Mandrake Linux RPMs
|
|
www.aucs.org/rpmcenter/
|
Edwin Chan's Red Hat RPMs
|
|
www.owlriver.com/projects/links/
|
Owl River Company RPMs
|
|
Tool
|
Site
|
|
apt-rpm
|
ftp://ftp.conectiva.com/pub/conectiva/EXPERIMENTAL/apt/
|
|
apt4rpm
|
http://apt4rpm.sourceforge.net/
|
|
AutoRPM
|
www.autorpm.org
|
|
AutoUpdate
|
www.mat.univie.ac.at/~gerald/ftp/autoupdate
|
|
current
|
www.biology.duke.edu/computer/unix/current/
|
|
kpackage
|
www.kde.org
|
|
MakeRPM.pl
|
www.perl.com/CPAN/modules/by-authors/id/JWIED
|
|
poldek
|
http://poldek.pld.org.pl/
|
|
rpm2html
|
rpmfind.net/linux/rpm2html/
|
|
rpmfind
|
rpmfind.net
|
|
RUST
|
www.rusthq.com
|
|
setup.sh
|
www.mmedia.is/~bre/programs/setup.sh
|
|
urpmi
|
www.linux-mandrake.com/cooker/urpmi.html
|
| Revision History | |||
|---|---|---|---|
| Revision 1.0 | |||
|
| |||