-->
Page 283
# if cpp is not on your path, try one of these: -# CPP=/lib/cpp # traditional +CPP=/lib/cpp # traditional # CPP=/usr/lib/cpp # also traditional # CPP=/usr/ccs/lib/cpp # Solaris 2.x #
The patch file contains complete copies of our config.h and options.h files, followed by the changes we've made to munge. Looks good! Time to hand this grunt work over to RPM.
Since amanda comes in two parts, it's obvious that we'll need to use subpackages: one for the client software and one for the server. Given that, and the fact that the first part of any spec file consists of tags that are easily filled in, let's sit down and fill in the blanks, tag-wise:
Summary: Amanda Network Backup System Name: amanda Version: 2.3.08 Release: 1 Group: System/Backup Copyright: BSD-like, but see COPYRIGHT file for details Packager: Edward C. Bailey <bailey@rpm.org> URL: http://www.cs.umd.edu/projects/amanda/ Source: ftp://ftp.cs.umd.edu/pub/amanda/amanda-2.3.0.tar.gz Patch: amanda-2.3.0-linux.patch %description Amanda is a client/server backup system. It uses standard tape devices and networking, so all you need is any working tape drive and a network. You can use it for local backups as well.
That part was pretty easy. We set the package's release number to 1. We'll undoubtedly be changing that as we continue work on the spec file. You'll notice that we've included a URL tag line; the uniform resource locator there points to the home page for the amanda project, making it easier for the user to get additional information on amanda.
The Source tag here includes the name of the original source tar file and is preceded by the URL pointing to the file's primary location. Again, this makes it easy for the user to grab a copy of the sources from the software's "birthplace."
Finally, the patch file that we've just created gets a line of its own on the Patch tag line.
Next, let's take a look at the tags for our two subpackages. Let's start with the client:
%package client Summary: Client-side Amanda package Group: System/Backup Requires: dump %description client The Amanda Network Backup system contains software necessary to automatically perform backups across a network. Amanda consists of two packages -- a client (this package), and a server:
Page 284
The client package enable a network-capable system to have its filesystems backed up by a system running the Amanda server.
NOTE: |
In order for a system to perform backups of itself, install both the client and server packages! |
The %package directive names the package. Because we wanted the subpackages to be named amanda-<something>, we didn't use the -n option. This means our client subpackage will be called amanda-client, just as we wanted. RPM requires unique summary, %description, and group tags for each subpackage, so we've included them. Of course, it would be a good idea even if RPM didn't require themwe've used the tags to provide client-specific information.
The requires tag is the only other tag in the client subpackage. Because amanda uses dump on the client system, we included this tag so that RPM will ensure that the dump package is present on client systems.
Next, let's take a look at the tags for the server subpackage:
%package server Summary: Server-side Amanda package Group: System/Backup %description server The Amanda Network Backup system contains software necessary to automatically perform backups across a network. Amanda consists of two package -- a client, and a server (this package): The server package enables a network-capable system to control one or more Amanda client systems performing backups. The server system will direct all backups to a locally attached tape drive. Therefore, the server system requires a tape drive.
NOTE: |
In order for a system to perform backups of itself, install both the client and server packages! |
No surprises here, really. You'll note that the server subpackage has no requires tag for the dump package. The reason for that is due to a design decision we've made. Since amanda is comprised of a client and a server component, in order for the server system to perform backups of itself, the client component must be installed. Since we've already made the client subpackage require dump, we've already covered the bases.
Since an amanda server cannot back itself up without the client software, why don't we have the server subpackage require the client subpackage? Well, that could be done, but the fact of the matter is that there are cases where an amanda server won't need to back itself up. So the server subpackage needs no package requirements.
Next we need to add the build-time scripts. There's really not much to them:
%prep %setup
Page 285
%build make %install make install
The %prep script consists of one line containing the simplest flavor of %setup macro. Since we only need %setup to unpack one set of sources, there are no options we need to add.
The %build script is just as simple, with the single make command required to build amanda.
Finally, the %install script maintains our singe-line trend for build-time scripts. Here a simple make install will put all the files where they need to be for RPM to package them.
The last part of our initial attempt at a spec file is a %files list for each package the spec file will build. Because we're planning on a client and a server subpackage, we'll need two %files lists. For the time being, we'll just add the %files lines; we'll be adding the actual filenames later:
%files client %file server
There's certainly more to come, but this is enough to get us started. And the first thing we want RPM to do is to unpack the amanda sources.
In keeping with a step-by-step approach, RPM has an option that let's us stop the build process after the %prep script has run. Let's give the -bp option a try and see how things look:
# rpm -bp amanda-2.3.0.spec * Package: amanda * Package: amanda-client * Package: amanda-server + umask 022 + echo Executing: %prep Executing: %prep + cd /usr/src/redhat/BUILD + cd /usr/src/redhat/BUILD + rm -rf amanda-2.3.0 + gzip -dc /usr/src/redhat/SOURCES/amanda-2.3.0.tar.gz + tar -xvvf - drwxr-xr-x 3/20 0 May 19 22:10 1996 amanda-2.3.0/ -rw-r--r-- 3/20 1389 May 19 22:11 1996 amanda-2.3.0/COPYRIGHT -rw-r--r-- 3/20 1958 May 19 22:11 1996 amanda-2.3.0/Makefile -rw-r--r-- 3/20 11036 May 19 22:11 1996 amanda-2.3.0/README ... -rw-r--r-- 3/20 2010 May 19 22:11 1996 amanda-2.3.0/man/amtape.8 drwxr-xr-x 3/20 0 May 19 22:11 1996 amanda-2.3.0/tools/ -rwxr-xr-x 3/20 2437 May 19 22:11 1996 amanda-2.3.0/tools/munge + [ 0 -ne 0 ] + cd amanda-2.3.0