-->

Previous | Table of Contents | Next

Page 30

2.4.6. --force: The Big Hammer

Adding --force to an install command is a way of saying "Install it anyway!" In essence, it adds --replacepkgs and --replacefiles to the command. Like a big hammer, --force is an irresistible force (no pun intended) that makes things happen. In fact, the only thing that will prevent an install from proceeding when --force is used is a dependency conflict.

And as with a big hammer, it pays to fully understand why you need to use --force before actually using it.

2.4.7. --excludedocs: Do Not Install Documentation for This Package

RPM has a number of good features. One of them is that RPM classifies the files it installs into one of three categories:

RPM uses the --excludedocs option to prevent files classified as documentation from being installed. In the following example, we know that the package contains documentation, specifically, the man page: /usr/man/man1/cdp.1. Let's see how --excludedocs keeps it from being installed:


# rpm -iv --excludedocs cdp-0.33-3.i386.rpm

Installing cdp-0.33-3.i386.rpm

# ls -al /usr/man/man1/cdp.1

ls: /usr/man/man1/cdp.1: No such file or directory

#

The primary reason to use --excludedocs is to save disk space. The savings can be sizable. For example, on an RPM-installed Linux system, there can be more than 5,000 documentation files, using nearly 50MB.

If you like, you can make --excludedocs the default for all installs. To do this, simply add the following line to /etc/rpmrc, .rpmrc in your login directory, or the file specified with the --rcfile option:


excludedocs: 1

After that, every time an rpm -i command is run, it will not install any documentation files. For more information on rpmrc files, see Appendix B, "The rpmrc File."

Page 31

2.4.8. --includedocs: Install Documentation for This Package

As the name implies, --includedocs directs RPM to install any files marked as being documentation. This option is normally not required, unless the rpmrc file entry excludedocs: 1 is included in the referenced rpmrc file. Here's an example. Note that in this example, /etc/rpmrc contains excludedocs: 1, which directs RPM not to install documentation files:


# ls /usr/man/man1/cdp.1

ls: /usr/man/man1/cdp.1: No such file or directory

# rpm -iv cdp-0.33-3.i386.rpm

Installing cdp-0.33-3.i386.rpm

# ls /usr/man/man1/cdp.1

ls: /usr/man/man1/cdp.1: No such file or directory

#

Here we've checked to make sure that the cdp man page did not previously exist on the system. Then after installing the cdp package, we find that the excludedocs: 1 in /etc/rpmrc did its job: The man page wasn't installed. Let's try it again, this time adding the --includedocs option:


# ls /usr/man/man1/cdp.1

ls: /usr/man/man1/cdp.1: No such file or directory

# rpm -iv --includedocs cdp-0.33-3.i386.rpm

Installing cdp-0.33-3.i386.rpm

# ls /usr/man/man1/cdp.1

-rw-r--r-- 1 root root 4550 Apr 24 22:37 /usr/man/man1/cdp.1

#

The --includedocs option overrode the rpmrc file's excludedocs: 1 entry, causing RPM to install the documentation file.

2.4.9. --prefix <path>: Relocate the Package to <path>, if Possible

Some packages give the person installing them flexibility in determining where on his system they should be installed. These are known as relocatable packages. A relocatable package differs from a package that cannot be relocated in only one way—the definition of a default prefix. Because of this, it takes a bit of additional effort to determine whether a package is relocatable. But here's an RPM command that can be used to find out:


rpm -qp --queryformat "%{defaultprefix\}\n" <packagefile>


NOTE
You can find more about RPM's query commands in Chapter 5, "Getting Information About Packages."

2.4.10. --noscripts: Do Not Execute Pre- and Postinstall Scripts

Before we talk about the --noscripts option, we need to cover a bit of background. In section 2.4.1, you saw some output from an install using the -vv option. As you can see, there are two lines that mention preinstall and postinstall scripts. When some packages are installed, they may require that certain programs be executed before, after, or before and after the package's files are copied to disk.


NOTE
It's possible to use RPM's query command to see if a package has pre- or postinstall scripts. See section 5.2.2 in Chapter 5 for more information.

The --noscripts option prevents these scripts from being executed during an install. This is a very dangerous thing to do! The --noscripts option is really meant for package builders to use

Previous | Table of Contents | Next