Create an autoconf-like installation script

Description

With a proper install script, a number of installation parameters (particularly file paths) can be specified on the command line and used not only to copy distribution files to the indicated locations, but also to set some values in their configuration files, saving administrators the need to edit multiple config files later.

At least three installation modes would be required, specified by flags:

--content-filter : amavisd-maia, Perl scripts

--web-server : PHP scripts, Smarty templates

--database-server : SQL schemas

That way, the install script could be used on all three types of servers, or used with all of these flags if everything is to be installed on a single host.

Installation paths for amavisd-maia, the Perl scripts, the PHP scripts, amavis home directory, and so on could also be specified with individual flags, using default values if an item is not explicitly specified.

This same flag-based mechanism could also be used to perform template substitutions in files like amavisd.conf, letting the administrator specify the paths to things like clamd and spamd sockets, Blowfish key files, and various other parameters that would otherwise have to be hand-edited after installation. Similarly, the location of the database.cfg file could be substituted into templates for the various Perl scripts.

In the case of the database server, the install script could perform a connection test and thus determine whether an existing Maia database is in danger of being overwritten, and if no existing database is found, the install script could then create the database from the schema. If certain schema items are to be overridden at install-time (e.g. score threshold defaults, default language/character set, default theme, etc.), command-line flags could be used to do so.

The full GNU autoconf is probably overkill for something like this, but a relatively simple Perl script could do this job. Configuration files would need to be distributed in template form, e.g. amavisd.conf.dist, with macros inserted in them for substitution by the install script, e.g. "%%BLOWFISH_KEY_PATH%%", etc.

Change History

One thing I also noticed: the Perl scripts all have similar configurable options, which are all the same. Wouldn't it be better to have those options in one single file, which are somehow included/read by the other files?

The operative phrase being "somehow" :) There's still the small matter of how the scripts should know where to find that master configuration file to include. Wherever you put that file, you still need to tell each of those scripts where it is.

We already do this, for instance, with the database.cfg file, which centralizes the database connection information so that you don't need to repeat it in every script. Unfortunately the scripts still need to know where to find the database.cfg file, so there's no avoiding the need to configure at least that one item in every script.

The install script proposed in this ticket would do the job of setting those values, of course.