📄 0063-0065.html
字号:
<HTML>
<HEAD>
<TITLE>Maximum RPM (RPM):Getting Information About Packages:EarthWeb Inc.-</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311054 //-->
<!-- TITLE=Maximum RPM (RPM)//-->
<!-- AUTHOR=Edward Bailey//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=05 //-->
<!-- PAGES=0053-0078 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0060-0062.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0066-0068.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-63"><P>Page 63</P></A>
<!-- CODE SNIP //-->
<PRE>
# rpm -qlv adduser
-rwxr-xr-x- root root 3894 Feb 25 13:45 /usr/sbin/adduser
#
</PRE>
<!-- END CODE SNIP //-->
<P>Looks a lot like the output from ls, doesn't it? Looks can be deceiving. Everything you see
here is straight from RPM's database. However, the format is identical to that of
ls, so it's more easily understood. If this is Greek to you, consult the
ls man page.
</P>
<B>
5.2.2.4. -c: Display the Package's List of Configuration Files
</B>
<P>When -c is added to an rpm -q command, RPM will display the
configuration files that are part of the specified package or packages. As mentioned earlier in the book, config files
are important because they control the behavior of the packaged software. Let's take a look at
the list of config files for XFree86:
</P>
<!-- CODE //-->
<PRE>
# rpm -qc XFree86
/etc/X11/fs/config
/etc/X11/twm/system.twmrc
/etc/X11/xdm/GiveConsole
/etc/X11/xdm/TakeConsole
/etc/X11/xdm/Xaccess
/etc/X11/xdm/Xresources
/etc/X11/xdm/Xservers
/etc/X11/xdm/Xsession
/etc/X11/xdm/Xsetup 0
/etc/X11/xdm/chooser
/etc/X11/xdm/xdm-config
/etc/X11/xinit/xinitrc
/etc/X11/xsm/system.xsm
/usr/X11R6/lib/X11/XF86Config
#
</PRE>
<!-- END CODE //-->
<P>These are the files you'd want to look at first if you were looking to customize XFree86
for your particular needs. Just like -l, we can also add
v for more information:
</P>
<!-- CODE //-->
<PRE>
# rpm -qcv XFree86
-r--r--r--- root root 423 Mar 21 00:17 /etc/X11/fs/config
...
lrwxrwxrwx- root root 30 Mar 21 00:29 /usr/X11R6/lib/X11/XF86Config
-> ../../../../etc/X11/XF86Config
#
</PRE>
<!-- END CODE //-->
<P>Note that last file: RPM will display symbolic links, as well.
</P>
<B>
5.2.2.5. -d: Display a List of the Package's Documentation
</B>
<P>When -d is added to a query, we get a list of all files
containing documentation for the named package or packages. This is a great way to get up to speed when you're having problems
with unfamiliar software. As with -c and -l, you'll see either a simple list of filenames or (if
you've added -v) a more comprehensive list. Here's an example that might look daunting at first,
but really isn't:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -qdcf /sbin/dump
/etc/dumpdates
</PRE>
<!-- END CODE SNIP //-->
<A NAME="PAGENUM-64"><P>Page 64</P></A>
<!-- CODE //-->
<PRE>
/usr/doc/dump-0.3-5
/usr/doc/dump-0.3-5/CHANGES
/usr/doc/dump-0.3-5/COPYRIGHT
/usr/doc/dump-0.3-5/INSTALL
/usr/doc/dump-0.3-5/KNOWNBUGS
/usr/doc/dump-0.3-5/THANKS
/usr/doc/dump-0.3-5/dump-0.3.announce
/usr/doc/dump-0.3-5/dump.lsm
/usr/doc/dump-0.3-5/linux-1.2.x.patch
/usr/man/man8/dump.8
/usr/man/man8/rdump.8
/usr/man/man8/restore.8
/usr/man/man8/rmt.8
/usr/man/man8/rrestore.8
#
</PRE>
<!-- END CODE //-->
<P>Let's take that alphabet soup set of options one letter at a time:
</P>
<UL>
<LI> q—Performs a query.
<LI> d—Lists all
documentation files.
<LI> c—Lists all
config files.
<LI> f—Queries the package
that owns the specified file (/sbin/dump in this case).
</UL>
<P>The list of files represents all the documentation and config files that apply to the package
owning /sbin/dump.
</P>
<B>
5.2.2.6. -s: Display the State of Each File in the Package
</B>
<P>Unlike the past three sections, which deal with lists of files of one type or another, adding
-s to a query will list the state of the files that comprise one or more packages. I can hear you
out there; you're saying, "What is the state of a file?" For every file that RPM installs, there is
an associated state. There are four possible states:
</P>
<UL>
<LI>normal—A file
in the normal state has not been modified by installing
another package on the system.
<LI>replaced—Files in the replaced state have been modified by installing another
package on the system.
<LI>not installed—A file is classified as not
installed when it isn't installed. This state is normally seen only if the package was partially installed. An example of a
partially installed package would be one that was installed with the
--excludedocs option. Using this option, no documentation files would be installed. The RPM
database would still contain entries for these missing files, but their state would be
not installed.
<LI>net shared—The net shared state is used to alert RPM to the fact that a file is on
a shared filesystem and should not be erased. This happens when several computers
use NFS to mount the same filesystem. If one computer erased a package that
contained files on a shared filesystem, the other computers sharing that filesystem would
then have incompletely installed copies of the erased package. Files will be in the
net shared state when two things happen:
</UL>
<A NAME="PAGENUM-65"><P>Page 65</P></A>
<UL>
<LI>The netsharedpath rpmrc file entry has been changed from
its default (null) value.
<LI>The file is to be installed in a directory within a net shared path.
</UL>
<P>Here's an example showing how file states appear:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -qs adduser
normal /usr/sbin/adduser
#
</PRE>
<!-- END CODE SNIP //-->
<P>The normal at the start of the line is the state, followed by the filename.
</P>
<P>The file state is one of the tools RPM uses to determine the most appropriate action to
take when packages are installed or erased.
</P>
<P>Would the average person need to check the states of files? Not really. But if there should
be problems, this kind of information can help get things back on track.
</P>
<B>
5.2.2.7. --provides: Display Capabilities Provided by the Package
</B>
<P>By adding --provides to a query command, you can see the capabilities provided by one
or more packages. If the package doesn't provide any
capabilities, the --provides option produces no output:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -q --provides rpm
#
</PRE>
<!-- END CODE SNIP //-->
<P>However, if a package does provide capabilities, they will be displayed:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -q --provides foonly
index
#
</PRE>
<!-- END CODE SNIP //-->
<P>It's important to remember that capabilities are not filenames. In the preceding example,
the foonly package contains no file called index; it's just a character string the package builder
chose. This is no different from the following example:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -q --provides libc
libm.so.5
libc.so.5
#
</PRE>
<!-- END CODE SNIP //-->
<P>While there might be symlinks by those names in
/lib, capabilities are a property of the package, not a file contained in the package!
</P>
<B>
5.2.2.8. --requires: Display Capabilities Required by the Package
</B>
<P>The --requires option (-R is equivalent) is the logical complement to the
--provides option. It displays the capabilities required by the specified package(s). If a package has no
requirements, there's no output (or, in later versions of RPM, the word
none):
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -q --requires adduser
#
</PRE>
<!-- END CODE SNIP //-->
<P><CENTER>
<a href="0060-0062.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0066-0068.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -