0279-0282.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 335 行
HTML
335 行
<HTML>
<HEAD>
<TITLE>Maximum RPM (RPM):Real-World Package Building: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=20 //-->
<!-- PAGES=0275-0304 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0275-0278.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0283-0285.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-279"><P>Page 279</P></A>
<P>so that they can be easily maintained. With RPM, there's no need to do this because every
file installed by RPM gets written into the database. In addition, Red Hat Linux systems adhere
to the File System Standard, so any package destined for Red Hat systems should really be
FSSTND compliant, too. Fortunately for us, amanda was written to make these types of changes
easy. But even if we had to hack an installation script, RPM would pick up the changes as part of
its patch handling.
</P>
<P>We'll spare you the usual discovery of typos, incompatibilities, and the resulting rebuilds.
After an undisclosed number of iterations, our
config.h and options.h files are perfect. Amanda now builds:
</P>
<!-- CODE //-->
<PRE>
# make
Making all in common-src
make[1]: Entering directory `/usr/src/redhat/SOURCES/amanda-2.3.0/common-src'
...
make[1]: Leaving directory `/usr/src/redhat/SOURCES/amanda-2.3.0/man'
#
</PRE>
<!-- END CODE //-->
<P>As noted, amanda is constructed so that most of the time changes will be necessary only
in tools/munge and in the two files in config. Our situation was no different—after all was
said and done, that was all we needed to hack.
</P>
<H4><A NAME="ch20_ 6">
20.2.3. Installing and Testing
</A></H4>
<P>As we all know, just because software builds doesn't mean that it's ready for prime time.
It's necessary to test it first. In order to test amanda, we need to install it. Amanda's makefile
has an install target, so let's use that to get started. We'll also get a copy of the output because
we'll need that later:
</P>
<!-- CODE //-->
<PRE>
# make install
Making install in common-src
...
make[1]: Entering directory `/usr/src/redhat/SOURCES/amanda-2.3.0/client-src'
Installing Amanda client-side programs:
install -c -o bin amandad /usr/lib/amanda
install -c -o bin sendsize /usr/lib/amanda
install -c -o bin calcsize /usr/lib/amanda
install -c -o bin sendbackup-dump /usr/lib/amanda
install -c -o bin sendbackup-gnutar /usr/lib/amanda
install -c -o bin runtar /usr/lib/amanda
install -c -o bin selfcheck /usr/lib/amanda
Setting permissions for setuid-root client programs:
(cd /usr/lib/amanda ; chown root calcsize; chmod u+s calcsize)
(cd /usr/lib/amanda ; chown root runtar; chmod u+s runtar)
...
Making install in server-src
Installing Amanda libexec programs:
install -c -o bin taper /usr/lib/amanda
install -c -o bin dumper /usr/lib/amanda
install -c -o bin driver /usr/lib/amanda
install -c -o bin planner /usr/lib/amanda
install -c -o bin reporter /usr/lib/amanda
install -c -o bin getconf /usr/lib/amanda
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-280"><P>Page 280</P></A>
<!-- CODE //-->
<PRE>
Setting permissions for setuid-root libexec programs:
(cd /usr/lib/amanda ; chown root dumper; chmod u+s dumper)
(cd /usr/lib/amanda ; chown root planner; chmod u+s planner)
Installing Amanda user programs:
install -c -o bin amrestore /usr/sbin
install -c -o bin amadmin /usr/sbin
install -c -o bin amflush /usr/sbin
install -c -o bin amlabel /usr/sbin
install -c -o bin amcheck /usr/sbin
install -c -o bin amdump /usr/sbin
install -c -o bin amcleanup /usr/sbin
install -c -o bin amtape /usr/sbin
Setting permissions for setuid-root user programs:
(cd /usr/sbin ; chown root amcheck; chmod u+s amcheck)
...
Installing Amanda changer libexec programs:
install -c -o bin chg-generic /usr/lib/amanda
...
Installing Amanda man pages:
install -c -o bin amanda.8 /usr/man/man8
install -c -o bin amadmin.8 /usr/man/man8
install -c -o bin amcheck.8 /usr/man/man8
install -c -o bin amcleanup.8 /usr/man/man8
install -c -o bin amdump.8 /usr/man/man8
install -c -o bin amflush.8 /usr/man/man8
install -c -o bin amlabel.8 /usr/man/man8
install -c -o bin amrestore.8 /usr/man/man8
install -c -o bin amtape.8 /usr/man/man8
...
#
</PRE>
<!-- END CODE //-->
<P>Okay, no major problems there. Amanda does require a bit of additional effort to get
everything running, though. Looking at
docs/INSTALL, we follow the steps to get amanda
running on our test system as both a client and a server. As we perform each step, we note it for
future reference.
</P>
<P>For the client:
</P>
<OL>
<LI> Set up an ~/.rhosts file, allowing the server to connect.
<LI> Make the disk device files readable by the client.
<LI> Make /etc/dumpdates readable and writable by the client.
<LI> Put an amanda entry in
/etc/services.
<LI> Put an amanda entry in
/etc/inetd.conf.
<LI> Issue a kill -HUP on inetd.
</OL>
<P>For the server:
</P>
<OL>
<LI> Create a directory to hold the server configuration files.
<LI> Modify the provided sample configuration files to suit our site.
<LI> Add crontab entries to run amanda nightly.
<LI> Put an amanda entry in
/etc/services.
</OL>
<A NAME="PAGENUM-281"><P>Page 281</P></A>
<P>Once everything is ready, we run a few tests. Everything performs flawlessly.
(Well, eventually it does!) Looks like we've got a good build. Let's start getting RPM involved.
</P>
<H3><A NAME="ch20_ 7">
20.3. Initial Building with RPM
</A></H3>
<P>Now that amanda has been configured, built, and is operational on our build system, it's
time to have RPM take over each of these tasks. The first task is to have RPM make the
necessary changes to the original sources. To do that, RPM needs a patch file.
</P>
<H4><A NAME="ch20_ 8">
20.3.1. Generating Patches
</A></H4>
<P>The amanda-2.3.0 directory tree is where we did all our work building amanda. We need
to take all the work we've done in that directory tree and compare it against the original
sources contained in the amanda-2.3.0-orig directory tree. But before we do that, we need to
clean things up a bit.
</P>
<H4><A NAME="ch20_ 9">
20.3.1.1. Cleaning Up the Test Build Area
</A></H4>
<P>Looking through our work tree, it has all sorts of junk in it: emacs save files, object files,
and the executable programs. In order to generate a clean set of patches, all these extraneous
files must go. Looking over amanda's makefiles, there is a clean target that should take care of
most of the junk:
</P>
<!-- CODE //-->
<PRE>
# make clean
Making clean in common-src
...
rm -f *~ *.o *.a genversion version.c Makefile.out
...
Making clean in client-src
...
rm -f amandad sendsize calcsize sendbackup-dump
sendbackup-gnutar runtar selfcheck *~ *.o Makefile.out
...
Making clean in server-src
...
rm -f amrestore amadmin amflush amlabel amcheck amdump
amcleanup amtape taper dumper driver planner reporter
getconf *~ *.o Makefile.out
...
Making clean in changer-src
...
rm -f chg-generic *~ *.o Makefile.out
...
Making clean in man
...
rm -f *~ Makefile.out
...
#
</PRE>
<!-- END CODE //--><A NAME="PAGENUM-282"><P>Page 282</P></A>
<P>Looking in the tools and config directories where we did all our work, we see that there
are still emacs save files there. A bit of studying confirms that the makefiles don't bother to
clean these two directories. That's a nice touch because a
make clean won't wipe out old copies of the config files, giving you a chance to go back to them in case you've botched
something. However, in our case, we're sure we won't need the save files, so out they go:
</P>
<!-- CODE //-->
<PRE>
# cd /usr/src/redhat/SOURCES/amanda-2.3.0
# find . -name "* " -exec rm -vf \;
./config/config.h
./config/options.h
./tools/munge
#
</PRE>
<!-- END CODE //-->
<P>We let find take a look at the whole directory tree, just in case there was something still
out there that we'd forgotten about. As you can see, the only save files are from the three files
we've been working on.
</P>
<P>You'll note that we've left our modified munge file, as well as the
config.h and options.h files we so carefully crafted. That's intentional, as we want to make sure those changes are
applied when RPM patches the sources. Everything looks pretty clean, so it's time to make the patches.
</P>
<H4><A NAME="ch20_ 10">
20.3.1.2. Actually Generating Patches
</A></H4>
<P>This step is actually pretty anticlimactic:
</P>
<!-- CODE SNIP //-->
<PRE>
# diff -uNr amanda-2.3.0-orig/ amanda-2.3.0/ > amanda-2.3.0-linux.patch
#
</PRE>
<!-- END CODE SNIP //-->
<P>With that one command, we've compared each file in the untouched directory tree
(amanda-2.3.0-orig) with the directory tree we've been working in
(amanda-2.3.0). If we've done our homework, the only things in the patch file should be related to the files we've changed.
Let's take a look through it to make sure:
</P>
<!-- CODE //-->
<PRE>
# cd /usr/src/redhat/SOURCES
# cat amanda-2.3.0-linux.patch
diff -uNr amanda-2.3.0-orig/config/config.h amanda-2.3.0/config/config.h
--- amanda-2.3.0-orig/config/config.h Wed Dec 31 19:00:00 1969
+++ amanda-2.3.0/config/config.h Sat Nov 16 16:22:47 1996
@@ -0,0 +1,52 @@
...
diff -uNr amanda-2.3.0-orig/config/options.h amanda-2.3.0/config/options.h
--- amanda-2.3.0-orig/config/options.h Wed Dec 31 19:00:00 1969
+++ amanda-2.3.0/config/options.h Sat Nov 16 17:08:57 1996
@@ -0,0 +1,211 @@
...
diff -uNr amanda-2.3.0-orig/tools/munge amanda-2.3.0/tools/munge
--- amanda-2.3.0-orig/tools/munge Sun May 19 22:11:25 1996
+++ amanda-2.3.0/tools/munge Sat Nov 16 16:23:50 1996
@@ -35,10 +35,10 @@
# Customize CPP to point to your system's C preprocessor.
# if cpp is on your path:
-CPP=cpp
+# CPP=cpp
</PRE>
<P><CENTER>
<a href="0275-0278.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0283-0285.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?