-->
Page 279
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.
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:
# 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' #
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 differentafter all was said and done, that was all we needed to hack.
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:
# 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
Page 280
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 ... #
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.
For the client:
For the server:
Page 281
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.
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.
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.
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:
# 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 ... #
Page 282
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:
# cd /usr/src/redhat/SOURCES/amanda-2.3.0 # find . -name "* " -exec rm -vf \; ./config/config.h ./config/options.h ./tools/munge #
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.
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.
This step is actually pretty anticlimactic:
# diff -uNr amanda-2.3.0-orig/ amanda-2.3.0/ > amanda-2.3.0-linux.patch #
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:
# 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