Figure 4-16 shows the zenity dialogs produced by this script. Obviously, this user interface is not as refined as one that could be provided by a full-featured GUI application, but it is perfectly suitable for simple interactions.
Figure 4-16. zenity dialogs
4.12.4. Where Can I Learn More?
bash chmod zenityChapter 5. Package Management
Fortunately, Fedora uses a software management system called RPM Package Manager or simply RPM (formerly RedHat Package Manager). RPM rolls all of the programs, scripts, documentation, configuration files, and data used by a piece of software into a single file called a package . The package also contains metadata describing the package, license, maintainers, and the packages upon which the package depends (for example, a KDE application will need other components of the KDE system to operate).
What RPM doesn't provide is dependency resolution : the ability to automatically resolve dependency issues. However, the yum system builds on RPM to provide this capability, automatically searching external repositories to find needed packages and install them automatically.
In this chapter, the sections Lab 5.1, "Querying the Package Management Database" and Lab 5.2, "Installing and Removing Software Using RPM" deal with individual package management from the command line. If you want to go directly to the simplest and most comprehensive way of managing software packages, skip to Lab 5.3, "Using Repositories."
5.1. Querying the Package Management Database
As RPM packages are installed on your system, the metadata for those packages is stored in a database that can be queried. If you have a mystery file on your system and want to know where it came from, or want to know which version of a package is installed, or what a package does, an RPM query can answer your question in a few seconds.
5.1.1. How Do I Do That?
rpmThe default query takes a package name and tells you whether it is installed and, if so, which version is installed:
$ rpm -q
selmyscan
package selmyscan is not installed
$ rpm -q httpd
httpd-2.0.54-10.2
More advanced queries use two different sets of arguments: one to control which packages are reported in the output, and one to control what is reported about the selected packages.
Table 5-1 describes the most commonly used options for selecting packages.
Table 5-1. RPM query options for package selection
| Option | Description |
|---|---|
| -a | Selects all packages. |
| -f file | Selects the package that installed file . |
| -g pkggroup | Selects the packages that belong to pkggroup (such as Applications/Productivity ). |
| -p pkgfile | Selects the uninstalled RPM package file pkgfile , which can be a local filename or an HTTP or FTP URI. Information is retrieved from the package file instead of from the RPM database. |
| --triggeredby package | Selects packages that have scripts that are triggered by the installation or removal of package . For example, a mail-client package may have a script that changes its configuration if the local mail server is changed from sendmail to postfix . |
| --whatprovides capability | Selects packages that provide a certain capability , such as the ability to run perl scripts. |
| --whatrequires capability | Selects packages that require a capability . |
| packagename | Selects a package with the given name. |
For example, to find out which package installed the file /usr/lib/libcdda_interface.so :
$ rpm -qf /usr/lib/libcdda_interface.so
cdparanoia-libs-alpha9.8-25
Or to find out which packages provide smtpdaemon (inbound mail server) capability:
$ rpm -q --whatprovidessmtpdaemon
sendmail-8.13.4-2
postfix-2.2.2-2
Sometimes, though, you need more information than the name and version number of the packages selected. Table 5-2 lists the most common query output options.
Table 5-2. Query output options
| Option | Description |
|---|---|
| --changelog | Shows the package changelog, a list of changes to the various versions of the package (not necessarily to various versions of the software). |
| -c | Shows the configuration files included in the package. |
| -d | Shows the documentation files included in the package. |
| -l | Lists files included in the package. |
| --filesbypkg | Same as -l, except that the package name is printed in front of each file; useful when multiple packages are selected. |
| -i | Provides detailed information about the package (package description, license, group, origin, and so forth). |
| --provides | Lists the capabilities provided by the package. |
| --requires | Lists the capabilities required to successfully use the package. |
| --scripts | Displays pre- and post-installation scripts, and pre- and post-uninstallation (removal) scripts. |
| --triggers | Displays the trigger scripts in the package. Trigger scripts are invoked when another, related package is installed or removed. |
When output options and selection options are combined, rpm becomes a very powerful tool. For example, to see the description of the package that installed /etc/mail/access :
$ rpm-qif /etc/mail/access
Name : sendmail Relocations: (not relocatable)
Version : 8.13.4 Vendor: Red Hat, Inc.