8. [Appendix] Building a Replacement radvd Package

There is nothing in this section you need to perform, it is simply here to demonstrate one way in which you can build a Debian package. Other systems, such as Redhat-based systems, will have a similar technique, though the tools will be different. You are not required to read this, unless you are interested.

There were multiple ways we could have built a newer version of radvd. To give you some idea, here is what we tried:

  1. Running the standard Ubuntu version of radvd by hand, with debugging turned on, we saw that it was crashing with a Segmentation fault when it received the first Router Solicitation packet. We adjusted our radvd.conf to make a very simple configuration, much like the simplest configuration example supplied with the software, but it still crashed.

  2. We tried using an unofficial APT repository that was built to fix some problems. We found this while following Ubuntu and Debian bug reports about the program. It didn’t solve the problem.

  3. We downloaded the latest release of the source code and build it from source. It didn’t solve the problem either, though we did figure out where it was crashing, which gave us more information.

  4. Using the information we learned in the previous failed attempt, we looked through the developers’ mailing list for the software, and found that there were some changes made to CVS around the area where the crash was occuring, and some other messages about different errors which lead to a crash in the same place. So we checked out the latest CVS (fingers crossed it has fewer bugs and not more). We built it from source, and found that the problem appears have to been fixed.

  5. Because we didn’t want you to have do a lot of things associated with installing this software from source (in this case, it would involve configuring the software at build-time to install things into the correct places, writing startup scripts and creating a special user), we downloaded the set of patches that Ubuntu and Debian use to apply to the “upstream” source-code. These patches largely are files that say how to build it into a Debian-style package.

    We could have gone further and put the package into a repository, which would allow you to install it using APT, as well as to install any dependencies, and allow for easier updates, but we decided not to at this point in time. If we were maintaining this on multiple machines, or were going to be rebuilding this package occassionally, that would be useful.

In brief, here are the commands we used to checkout the latest source from CVS and build it into Debian package:

Make a working directory, anywhere will do
$ mkdir -p ~/tmp/radvd-cvs
$ cd $_     $_ expands to the last argument of the previous command

Satisfy build dependencies etc. Some of this you learn through trial and error…
# apt-get install build-essential cvs autoconf libtool debhelper devscripts cdbs \
> flex bison
If asked to configure Postfix, just respond with “Local only” and accept defaults

Download the latest version from CVS
$ cvs -d :pserver:anonymous@cvs.litech.org:/work/cvsroot loginUse an empty password when prompted
$ cvs -d :pserver:anonymous@cvs.litech.org:/work/cvsroot checkout radvd$ cd radvd

Download the standard Ubuntu/Debian alterations that roughly match the version of radvd.
Link learned from http://packages.ubuntu.com/maverick/radvd
$ wget http://archive.ubuntu.com/ubuntu/pool/main/r/radvd/radvd_1.6-1.diff.gzApply the patch
$ zcat radvd_1.6-1.diff.gz | patch -p1Generate some initial build scripts (./configure and Makefile)
This is because the file (generated) file ./configure is not tracked in CVS
$ autoreconf -vif

Set the ‘local’ version number, so we know we’re dealing with ouwn version, not from Ubuntu
$ dch -l cvs20101217 'Using CVS head as of 2010-12-17'

Sit back and let the package build
$ dpkg-buildpackage -us -ucNow you can install the package
# dpkg -i ../radvd_1:1.6-1cvs201012171_i386.deb