[pmg-devel] [PATCH pmg-api 0/2] handle template overrides with ucf

Stoiko Ivanov s.ivanov at proxmox.com
Wed Mar 25 19:42:53 CET 2020


A long standing wish of some users (and some people doing support :)
is to track changes users do to the configuration templates, in a similar
fashion like debian handles changes to config-files upon upgrades.

The ucf (1) utility is usually used to handle config-files, which are not
shipped in a package, but e.g. get rendered in a packages postinst script.

While template-overrides are not done by our packages, but are manual
intervention of users - the tool still does a good job at tracking changes
upon upgrades.

I tried doing quite a bit of testing, given that this is a rather visible and
sensitive change:
* all users with changed templates in '/etc/pmg/templates' will
  get asked about the diff upon the first upgrade with this shipped
* config-templates are quite central to PMG's functioning

Tests include (based on experience in forum+enterprise support):
* copying+modifying a single template and upgrading
  debconf asks for changes
* copying+modifying a single template, having it registed with ucf and
  upgrading to a version with modified template - debconf asks for changes
* copying all templates to /etc/pmg/templates and modifying only one:
  all files are registered - only the modified template raises a question
* shipping a modified template where a unmodfied copy exists in
  /etc/pmg/templates - the new shipped file is copied to /etc/pmg/templates
* removing a modified template - no question asked
* removing an unmodified template - no question asked

Which all in all seem quiet sensible to me.

Would of course be grateful for more tests and suggestions for edge-cases.

The second commit tries to split package-building (top-level Makefile), from
building (src/Makefile) - but is optional as far as the generated package is
concerned

Stoiko Ivanov (2):
  Use ucf to handle template overrides.
  buildsys: put TEMPLATES into separate Makefile

 Makefile                   |  2 ++
 debian/postinst            | 20 +++++++++++++++++++-
 debian/postrm              | 26 ++++++++++++++++++++++++++
 src/Makefile               | 20 +-------------------
 src/templates/templates.mk | 20 ++++++++++++++++++++
 5 files changed, 68 insertions(+), 20 deletions(-)
 create mode 100644 debian/postrm
 create mode 100644 src/templates/templates.mk

-- 
2.20.1




More information about the pmg-devel mailing list