[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Packaging Arbitrary Files

Aaron Todd <toddaa@gmail.com> writes:

> Thanks for your responses.  I just want to make it clear, I am not
> trying to reinvent the wheel here.  I am not trying to cause any harm to
> the standard Apache package, and I guess I should have made it known
> what my ultimate goal was.

> What I am trying to accomplish is to streamline my own system setups.
> Currently, when I bring up a server I install apache from the
> repository.  I thought that if I could package my own apache config
> along with my HTML/PHP files I could eliminate the need to FTP
> everything to the destination folder, then check rights and permissions
> manually.

You're running into a known drawback of the Debian packaging system for
what are called "configuration packages," which are basically what you're
trying to do: make a package that provides a bunch of configuration files
for a local environment.

There is currently no particularly good way to do this with Debian
packages.  Debian packages were primarily designed for inclusion of
software in the Debian archive, and this sort of configuration change is
strictly against Debian Policy *for things in the archive*.  Therefore,
supporting it has never been important, and not supporting it is actually
somewhat of a "feature" in that it prevents us from doing bad things in
the archive.

However, this sort of local configuration package turns out to be a really
useful way to think about local configuration for particular environments,
where the packages would be hosted in a local repository.  At least, if it
worked, which it mostly doesn't.  :/

Your options are:

1. dpkg-divert the configuration file before replacing it with yours.
   This sort of works and sort of doesn't.  dpkg doesn't deal well with
   diverted configuration files in all cases, and you'll get odd
   problems.  Whether those odd problems will be significant or not for
   you is hard to say.

2. Ship the configuration files in some other location and then write a
   postinst script for your configuration package that copies them into
   place.  This mostly works since it simulates what an administrator of
   the system would do, but you'll still get dpkg prompts when the Debian
   package's configuration files change, which may or may not be good.  It
   also means the package manager doesn't know that your package is
   controlling those files, which isn't ideal.

3. Have your package declare that it Replaces the package that ships the
   configuration file.  This sort of works, but it's probably a bad idea,
   since upgrading the original Debian package will probably overwrite
   your package's files right back, or result in other weird changes.

4. Repackage the Debian packages with local versions with a higher
   version.  This of course works, but it's a *ton* of effort and it's a
   committment to keep up with all further changes to the Debian package
   and bump your local version.  It's a big pain in the ass, and I
   wouldn't do this.

5. Give up on using Debian packages to do this and instead use a separate
   configuration management system that doesn't do its work with packages
   (something like Puppet or Cfengine).  This is the option that most
   people take and it scales a lot better, but it's definitely more work.

Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

Reply to: