📄 0089-0092.html
字号:
<HTML>
<HEAD>
<TITLE>Maximum RPM (RPM):Using RPM to Verify Installed 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=06 //-->
<!-- PAGES=0079-0092 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0086-0088.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch07/0093-0096.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-89"><P>Page 89</P></A>
<P>This is not to say that the missing file problem is solved, just that no file verification was
performed.
</P>
<H4><A NAME="ch06_ 23">
6.3.9. -v: Display Additional Information
</A></H4>
<P>Although RPM won't report an error with the command syntax if you include the
-v option, you won't see much in the way of additional output:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vv bash
#
</PRE>
<!-- END CODE SNIP //-->
<P>Even if there are verification errors, adding
-v won't change the output:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vv apmd
S.5....T /etc/rc.d/init.d/apm
S.5....T /usr/X11R6/bin/xapm
#
</PRE>
<!-- END CODE SNIP //-->
<P>The only time that the -v option will produce output is when the package being verified has
a verification script. Any normal output from the script won't be displayed by RPM when
run without -v (note that failure messages will always be displayed):
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -V bother
#
</PRE>
<!-- END CODE SNIP //-->
<P>But when -v is added, the script's non-error-related output is displayed:
</P>
<!-- CODE SNIP //-->
<PRE>
# rpm -Vv bother
This is the bother 3.5 verification script
#
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="ch06_ 24">
6.3.10. -vv: Display Debugging Information
</A></H4>
<P>Sometimes it's necessary to have even more information
than we can get with -v. By adding another v, that's just what we'll get:
</P>
<!-- CODE //-->
<PRE>
# rpm -Vvv rpm
D: opening database in //var/lib/rpm/
D: verifying record number 2341208
D: dependencies: looking for libz.so.1
D: dependencies: looking for libdb.so.2
D: dependencies: looking for libc.so.5
#
</PRE>
<!-- END CODE //-->
<P>The lines starting with D: have been added by using
-vv. We can see where the RPM database is located and what record number contains information on the
rpm-2.3-1 package. Following that is the list of dependencies that the
rpm package requires.
</P>
<P>In the vast majority of cases, it will not be necessary to use
-vv. It is normally used by software engineers working on RPM itself, and the output can change without notice. However, it's
a handy way to gain insights into RPM.
</P>
<A NAME="PAGENUM-90"><P>Page 90</P></A>
<H4><A NAME="ch06_ 25">
6.3.11. --dbpath <path>: Use <path> to Find an RPM Database
</A></H4>
<P>In order for RPM to do its handiwork, it needs access to an RPM database. Normally,
this database exists in the directory specified by the
rpmrc file entry, dbpath. By default, dbpath is set to
/var/lib/rpm. Although the dbpath entry can be modified in the appropriate
rpmrc file, the --dbpath option is probably a better choice when the database path needs to be
changed temporarily. An example of a time the
--dbpath option would come in handy is when it's
necessary to examine an RPM database copied from another system. Granted, it's not a
common occurrence, but it's difficult to handle any other way.
</P>
<H4><A NAME="ch06_ 26">
6.3.12. --root <path>: Set Alternate Root to
<path>
</A></H4>
<P>Adding --root <path> to a verify command forces RPM to assume that the directory
specified by <path> is actually the root directory. In addition, RPM expects its database to reside in
the directory specified by the dbpath rpmrc file entry, relative to
<path>. (For more information on rpmrc file entries, see Appendix B, "The
rpmrc File.")
</P>
<P>Normally this option is only used during an initial system install or when a system has
been booted off a rescue disk.
</P>
<H4><A NAME="ch06_ 27">
6.3.13. --rcfile <rcfile>: Set Alternate
rpmrc File to <rcfile>
</A></H4>
<P>The --rcfile option is used to specify a file containing
default settings for RPM. Normally, this option is not needed. By default, RPM uses
/etc/rpmrc and a file named .rpmrc, located in your login directory.
</P>
<P>This option would be used if there were a need to switch between several sets of RPM
options. Software developer and package builders will be the people using
--rcfile. For more information on rpmrc files, see Appendix B.
</P>
<H3><A NAME="ch06_ 28">
6.4. We've Lied to You
</A></H3>
<P>Not really; we just omitted a few details until you've had a chance to see
rpm -V in action. These details are described in the following sections.
</P>
<H4><A NAME="ch06_ 29">
6.4.1. RPM Controls What Gets Verified
</A></H4>
<P>Depending on the type of file being verified, RPM will not verify every possible attribute.
Table 6.2 shows the attributes checked for each of the different file types.
</P>
<A NAME="PAGENUM-91"><P>Page 91</P></A>
<P>Table 6.2. File attributes verified for each file type.
</P>
<TABLE>
<TR><TD>
File
Type
</TD><TD>
File
Size
</TD><TD>
Mode
</TD><TD>
MD5
Check-
sum
</TD><TD>
Major
Number
</TD><TD>
Minor
Number
</TD><TD>
Symlink
String
</TD><TD>
Owner
</TD><TD>
Group
</TD><TD>
Modification
Time
</TD></TR><TR><TD>
Directory
File
</TD><TD>
</TD><TD>
X
</TD><TD>
</TD><TD>
</TD><TD>
</TD><TD>
</TD><TD>
X
</TD><TD>
X
</TD><TD>
</TD></TR><TR><TD>
Symbolic
Links
</TD><TD>
</TD><TD>
X
</TD><TD>
</TD><TD>
</TD><TD>
</TD><TD>
X
</TD><TD>
X
</TD><TD>
X
</TD><TD>
</TD></TR><TR><TD>
FIFO
</TD><TD>
</TD><TD>
X
</TD><TD>
</TD><TD>
</TD><TD>
</TD><TD>
</TD><TD>
X
</TD><TD>
X
</TD><TD>
</TD></TR><TR><TD>
Devices
</TD><TD>
</TD><TD>
X
</TD><TD>
</TD><TD>
X
</TD><TD>
X
</TD><TD>
</TD><TD>
X
X
</TD><TD>
</TD><TD>
Regular
Files
</TD></TR><TR><TD>
X
</TD><TD>
X
</TD><TD>
X
</TD><TD>
</TD><TD>
</TD><TD>
</TD><TD>
X
</TD><TD>
X
</TD><TD>
X
</TD></TR></TABLE>
<H4><A NAME="ch06_ 30">
6.4.2. The Package Builder Can Also Control What Gets Verified
</A></H4>
<P>When a package builder creates a new package, he can control what attributes are to be
verified on a file-by-file basis. The reasons for excluding specific attributes from verification can be
quite involved, but here's an example just to give you the flavor: When a person logs into a
system, there are device files associated with that user's terminal session. In order for the terminal
device (called tty) to function properly, the owner and group of the device must change to
that of the person logging in. Therefore, if RPM were to verify the package that created the
tty device files, any ttys that were in use at the time would fail to verify. However, by using
the %verify directive (see Chapter 13, "Inside the Spec File," for details on
%verify), a package builder can save you from trivial verification failures.
</P>
<A NAME="PAGENUM-92"><P>Page 92</P></A>
<P><CENTER>
<a href="0086-0088.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch07/0093-0096.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -