Managing Debian Installs
For a while I’ve been trying to find some easy way to keep a few machines I admin behaving the way I want them too with minimal effort. They don’t really need much maintenance — but I would like something to help keep them all in sync. Basically, something like FAI, but much, much simpler — ideally something that takes five minutes to understand, and another five minutes to deploy; and leave the more complicated and powerful tools for when they’re actually needed.
I figured what I really want was just a simple way to make a meta-package — one that doesn’t really provide any functionality, just tells apt/dpkg what I want installed (via Depends), and what I don’t want installed (via Conflicts) and adds any extra configuration stuff or local scripts that I decide I want.
But doing that with a real Debian package is harder than I’m really comfortable with — I don’t want to have to worry about potential lintian errors, or rules files and debhelper commands, or writing a Makefile to get my files installed or whatever, I want something more trivial than that. Looking for meta-package creators, the only one I spotted that I thought looked likely was cdd-dev, described as “Custom Debian Distributions common files for developing meta packages”. Unfortunately it seems to just provide templates, which makes things quicker, but no less complex.
Fortunately equivs (“Circumvent Debian package dependencies”) is actually used for metapackages these days, according to its maintainer on IRC and its long description:
This package provides a tool to create Debian packages that only contain dependency information.
One use for this is to create a metapackage: a package whose sole purpose is to declare dependencies and conflicts on other packages so that these will be automatically installed, upgraded, or removed.
Another use is to circumvent dependency checking. […]
That turned out to work much better than I remembered (from whenever I last tried it — back in ’99 I guess?), with the only drawback being that I couldn’t add files easily. But that’s just a matter of creating a patch to equivs, which I then won’t have to worry about again. So having done that, I can now create a metapackage to do whatever I want by creating a file like:
Suite: client Section: misc Priority: standard Package: ajs-client-stuff Version: 20071114.1 Maintainer: Anthony Towns <aj@erisian.com.au> Description: Metapackage for aj's client computers Depends on necessary packages, etc. File: /etc/apt/sources.list.d/client.list deb http://mirror.localnet/debian etch main contrib non-free deb http://mirror.localnet/debian etch-proposed-updates main contrib non-free . deb http://security.debian.org/ etch/updates main contrib non-free File: postinst #!/bin/sh -e . apt-key add - <<EOF [output of gpg --armour --export $KEY] EOF . ##DEBHELPER##
debhelper kindly takes care of getting the permissions right for me, and equivs will generate a full source package if I tell it to, which I can just upload to mini-dinstall and have a regular Debian repository just by writing a text file and running equivs-build. And my metapackage can add dependencies, conflicts, apt sources, cronjobs, scripts, configuration files, documentation, or whatever I happen to want — which means I can make it automatically update itself, and thus install any dependencies or remove any conflicts, which then means that modifying the config on all the machines is just a matter of updating the metapackage. And new installs is (hopefully) just a matter of doing a standard install and then adding the metapackage. Perfect.
…even if it is really little more than a reinvention of rpm’s .spec files. :)