-->

Previous | Table of Contents | Next

Page 309

This indicates two things. I need to upgrade to my kernel 2.0.28, and if I install a newer version of dosemu, I will also need to install a newer version of xdosemu. Although it is usually not a good idea to ignore dependency problems, using the --nodeps option will cause RPM to ignore these errors and install the package.

Upgrading Packages

RPM's upgrade mode provides an easy way to upgrade existing software packages to newer versions. Upgrade mode is similar to install mode:


rpm -U [options] [packages]

options can be any of the install options or any of the general options.

Here is an example of how to upgrade packages. On my system I am currently running emacs version 19.31, but I want to upgrade to the newer emacs version 19.34. To upgrade, I use the following command:


# rpm -Uvh emacs-19.34-4.i386.rpm

The upgrade mode is really a combination of two operations, uninstall and install. First, RPM uninstalls any older versions of the requested package and then installs the newer version. If an older version of the package does not exist, RPM will simply install the requested package.

An additional advantage of upgrade over manual install and uninstall is that upgrade automatically saves configuration files. For these reasons, some people prefer to use upgrade rather than install for all package installations.

Uninstalling Packages

The uninstall mode of RPM provides for a clean method of removing files belonging to a software package from many locations.

Many packages install files in /etc, /usr, and /lib, so removing a package can be confusing, but with RPM an entire package can be removed as follows:


rpm -e [options] [package]

options is one of the options listed later in this section, and package is the name of the package to be removed. For example, if I want to remove the package for dosemu, the command is as follows:


rpm -e dosemu

The name specified here for the package is just the name of the package, not the name of the file that was used to install the package. If I had asked for


rpm -e dosemu-0.64.1-1.i386.rpm

Page 310

the following error would have been generated:


package dosemu-0.64.1-1.i386.rpm is not installed

Another common error encountered while trying to uninstall packages is a dependency error. This occurs when a package that is being uninstalled has files required by another package. For example, when I try to remove dosemu from my system, I get the following error:


removing these packages would break dependencies:

dosemu = 0.64.1 is needed by xdosemu-0.64.1-1

This means that the package xdosemu would not function properly if the package dosemu were removed. If I still wanted to remove this package, RPM could be given the --nodeps option to make it ignore dependency errors.

The other useful option is the --test option, which causes RPM to go through the motions of removing a package without actually removing anything. Usually there is no output from an uninstall, so the -vv option is given along with the --test option to see what would happen during an uninstall. For example,


rpm -e -vv --test xdosemu

produces the following output on my system:


D: counting packages to uninstall

D: opening database in //var/lib/rpm/

D: found 1 packages to uninstall

D: uninstalling record number 1650520

D: running preuninstall script (if any)

D: would remove files test = 1

D: /usr/man/man1/xtermdos.1 - would remove

D: /usr/man/man1/xdos.1 - would remove

D: /usr/bin/xtermdos - would remove

D: /usr/bin/xdos - would remove

D: /usr/X11R6/lib/X11/fonts/misc/vga.pcf - would remove

D: running postuninstall script (if any)

D: script found - running from file /tmp/02695aaa

+ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin

+ export PATH

+ [ -x /usr/X11R6/bin/mkfontdir ]

+ cd /usr/X11R6/lib/X11/fonts/misc

+ /usr/X11R6/bin/mkfontdir

D: would remove database entry

As you can see, the files that would have been removed are clearly indicated in the output.

Querying Packages

The querying mode in RPM allows for determining the various attributes of packages. The basic syntax for querying packages is


rpm -q [options] [packages]

Page 311

where options is one or more of the query options listed later in this section. The most basic query is one similar to


rpm -q kernel

On my system, this prints out the following line for the kernel package:


kernel-2.0.27-5

In a manner similar to uninstall, RPM's query mode uses the name of the package, not the name of the file that the package came in, for queries.

Now for a few more sample queries. If you wanted to get a list of all the files "owned" by the kernel package, you can use the -l option:


rpm -ql kernel

This outputs the following list of files on my system:


/boot/System.map-2.0.27

/boot/module-info

/boot/vmlinuz-2.0.27

In addition to getting a list of the files, you can determine their state by using the -s option:


rpm -qs kernel

This option gives the following information about the state of files in my kernel package:


normal        /boot/System.map-2.0.27

normal        /boot/module-info

normal        /boot/vmlinuz-2.0.27

If any of these files reported a state of missing, there would probably be problems with the package.

In addition to the state of the files in a package, the documentation files and the configuration files can be listed. To list the documentation that comes with the dosemu package, use the following:


rpm -qd dosemu

This produces the following list:


/usr/man/man1/dos.1

To get the configuration files for the same package, you would use the following query:


rpm -qc dosemu

This results in the following list:


/etc/dosemu.conf

/var/lib/dosemu/hdimage

Previous | Table of Contents | Next