On Thu, 18 Apr 2024, Mike Castle wrote:
Now, I would like to expand that into also setting up various config files that I currently do manually, for example, the `/etc/apt/*` configs I need to make the above work. For a single set of files, manual isn't bad, but as I want to get into setting up LDAP, autofs, and so on, it is time to explore solutions. I only have four systems at the moment (two physical and two virtual), so I don't think I need something too fancy.
I do this - but it needs a bit of thought as to how you want to do it. I'm assuming you don't care about debian policy ... I do one of four things in packages depending on what I want to achieve and what the package I'm configuring supports. 1.(easiest) - just drop a config file into a conf.d directory. I use this for maintaining sources.list. Back in the buster days I was using openssh from backports that supported this as maintaining the config is so much easier than any of the other ways and so much easier to fix bugs in your packages - a failing postinst script can be a pain to resolve. apt-mirror@aptmirror19:~ (none)$ apt-cache search bookworm-sources bookworm-sources - Meta-package to pull in list of apt-sources for debian (I generate these packages automatically from what is available on deb.debian.org.) FWIW, I also have a dev repo and a fast repo - the dev repo is a clone where I can test out substantial changes and the fast repo only has a couple of packages but can rebuild "the world" very quickly when I'm testing. So I have a number of extra levels of indirection to support this: $ apt-cache depends bookworm-sources bookworm-sources Depends: bookworm-local-sources That is the normal package that I would install. apt-mirror@aptmirror19:/mnt/mirror/local/main/o (master)$ apt-cache depends bookworm-dev-sources bookworm-dev-sources Depends: bookworm-dev-main-sources That lets me use the dev repo - and thanks to pinning, the packages in it will replace (even downgrade) packages from local. Ditto for my fast repo. 2. (next easiest) - add a file in /usr/share/ and then overwrite the file in /etc by copying in postinst. 3. edit the config file without diverting it using a sed script. 4. divert the config and edit/replace it in the package. 3. and 4. in particular can make upgrades more difficult if/when you find bugs in the way you're handling diversions and uninstalls.