Building a Mac OS X Package for Amanda

From The Open Source Backup Wiki (Amanda, MySQL Backup, BackupPC)

Jump to: navigation, search

This document discusses creating a MacOS X package (a .pkg file) from scratch. This process can be automated, although discussion of how that' done is beyond the scope of this document. Also helpful is Installing Amanda on Mac OS X

Contents

Prerequisites

You will need Apple's XCode (download the latest version from Apple at http://developer.apple.com/tools/xcode/). If you want to compile from subversion, rather than a distribution tarball, you'll need autotools (use Fink or DarwinPorts, or install them manually)

Overview

The basic plan here is to compile Amanda and install it into a temporary location (/tmp/amroot). The result is essentially an overlay containing the files that make install would create. We then use Package Maker to bundle that overlay with some additional scripts and utilities into a package.

Compile

Amanda should be compiled as described in Installing Amanda on Mac OS X. You will need to create the amandabackup user, although creating the remaining directories is not required.

The configuration is minimally

./configure --prefix=/usr/local --with-user=amandabackup --with-group=wheel --sysconfdir=/private/etc --localstatedir=/private/var --with-tmpdir=/private/tmp/amanda

However, instead of sudo make install, run

sudo make DESTDIR=/tmp/amroot install

You should now have a full amanda install located under /tmp/amroot/.

Fat build

Amanda is quite easy to compile into "fat" binaries; simply add the following before your ./configure:

    CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \
    LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" \

To be able to compile the 2.5.1p3 source as a Universal Binary, you have to add a --disable-dependency-tracking as one of the parameters when running ./configure, otherwise the comppiler complains about using -M and -E switches when compiling for multiple architectures.

Build Package

Cleanup

First, you'll need to shift the amanda install around a little bit. You only want it to install the stuff under /usr/local; letting the Apple installer make changes in /private/var or /private/etc is asking for trouble. So remove those directories from /tmp/amroot.

Resources

You will probably want to run some scripts, for example, to create the 'amandabackup' user, as part of your package's installation. Create a Resources directory. In this example, it's at /tmp/Resources, but you may not consider your resources "temporary" once you've spent a few hours honing your scripts. Create scripts in this directory named e.g., InstallCheck or postinstall. See some of the links and XCode's included documentation for pointers.

Make Package Project

Create a new package with PackageMaker, with the following settings:

Root 
/tmp/amroot/usr/local/
Default Location 
/usr/local/
Authentication 
root
Relocatable 
unchecked
Extras 
/tmp/Resources
Package Version 
(as appropriate for the version you're packaging

Then build the package.

Links

Personal tools