# 3 - Packaging Your Software with EPM

This chapter describes how to use EPM to package your own software packages.

## The Basics

EPM reads one or more software "list" files that describe a single software package. Each list file contains one or more lines of ASCII text containing product or file information. Comments start with the `#` character, directives start with the `%` character, variable start with the `$` character, and files, directories, and symlinks start with a letter.

### Product Information

Every list file needs to define the product name, copyright, description, license, README file, vendor, and version:

    %product Kung Foo Firewall
    %copyright 1999-2002 by Foo Industries, All Rights Reserved.
    %vendor Foo Industries
    %license COPYING
    %readme README
    %description Kung Foo firewall software for your firewall.
    %version 1.2.3p4 1020304

The `%license` and `%readme` directives specify files for the license agreement and README files for the package, respectively.

The `%product`, `%copyright`, `%vendor`, and `%description` directives take text directly from the line.

The `%version` directive specifies the version numbers of the package. The first number is the human-readable version number, while the second number is the integer version number. If you omit the integer version number, EPM will calculate one for you.

### Files, Directories, and Symlinks

Each file in the distribution is listed on a line starting with a letter. The format of all lines is:

    type mode owner group destination source options

Regular files use the letter `f` for the type field:

    f 755 root sys /usr/bin/foo foo

Configuration files use the letter `c` for the type field:

    c 644 root sys /etc/foo.conf foo.conf

Directories use the letter `d` for the type field and use a source path of "-":

    d 755 root sys /var/spool/foo -

Finally, symbolic links use the letter `l` (lowercase L) for the type field:

    l 000 root sys /usr/bin/foobar foo

The source field specifies the file to link to and can be a relative path.

### Wildcards

Wildcard patterns can be used in the source field to include multiple files on a single line:

    f 0444 root sys /usr/share/doc/foo *.html

## Building a Software Distribution

The `epm(1)` program is used to build software distributions from list files. To build a portable software distribution for an application called "foo", type the following command:

    epm foo ENTER

If your application uses a different base name than the list file, you can specify the list filename on the command-line as well:

    epm foo bar.list ENTER

EPM can also produce vendor-specific distributions using the `-f` option:

    epm -f format foo bar.list ENTER

The format option can be one of the following keywords:

- `aix` - AIX software distribution.
- `bsd` - FreeBSD, NetBSD, or OpenBSD software distribution.
- `depot` or `swinstall` - HP-UX software distribution.
- `dpkg` - Debian software distribution.
- `inst` or `tardist` - IRIX software distribution.
- `native` - "Native" software distribution (RPM, INST, DEPOT, PKG, etc.) for the platform.
- `osx` - MacOS X software distribution.
- `pkg` - Solaris software distribution.
- `portable` - Portable software distribution (default).
- `rpm` - RedHat software distribution.
- `setld` - Tru64 (setld) software distribution.

Everything in the software list file stays the same - you just use the `-f` option to select the format. For example, to build an RPM distribution of EPM, type:

    epm -f rpm epm

The result will be an RPM distribution file instead of the portable distribution file.

## Installing the Software Package

Once you have created the software distribution, you can install it. Portable distributions create an install script called product.install, where "product" is the name of the package:

    cd os-release-arch ENTER
    ./product.install ENTER

After answering a few yes/no questions, the software will be installed. To bypass the questions, run the script with the `now` argument:

    cd os-release-arch ENTER
    ./product.install now ENTER

## Including the Setup GUI

EPM also provides an optional graphical setup program. To include the setup program in your distributions, create a product logo image in XPM format and use the `--setup-image` option when creating your distribution:

    epm --setup-image foo.xpm foo ENTER