Why this patch

I wanted to create qmail binary packages that run, as users expect, on any machine of matching OS and architecture.

To that end, I’ve adapted qmail to build

  • As non-root,
  • Without hardcoded IDs,
  • To a staging area.

If you’re a packager, or otherwise trying to automate your builds, this patch may be useful to you.

Without this patch

To build and install as root, directly into /var/qmail, hardcoding the numeric IDs of the build host’s users and groups:

# groupadd ...; useradd ...
# make setup check

With this patch

To build as non-root, into a staging area /var/tmp/qmailbuild, with numeric IDs to be looked up at runtime on the installed system:

$ echo /var/tmp/qmailbuild > conf-destdir
$ make setup install-destdir

Then to install as root, from the staging area, into /var/qmail:

# groupadd ...; useradd ...
# cp -R /var/tmp/qmailbuild /var/qmail
# ./install-destdir
# make check

If you’re just here for the runtime ID lookup, you can continue to build and install as root, directly into /var/qmail, without a separate staging area:

# cp conf-qmail conf-destdir
# make setup install-destdir
# groupadd ...; useradd ...
# ./install-destdir
# make check

Get this patch

Download and apply netqmail-1.06-destdir-20181217.patch.

(Generated with git diff netqmail-1.06 netqmail-1.06-destdir-20181217.)

Improve this patch

If you see a simpler way to do it, I’d love to know.