pmg-api/debian/postrm
Stoiko Ivanov ac81f7c976 Use ucf to handle template overrides
ucf(1) is a utility to track changes in config files which are not shipped in
the debian package (but e.g. get generated through the postinst script)

While the template overriding mechanism of PMG does not directly write those
config files - users who override a config-file currently need to manually
compare the templates shipped in '/var/lib/pmg/templates' on every upgrade.

By selectively registering the existing template overrides with ucf, users get
asked once upon the next upgrade regarding their changes, and then will
always get prompted when the shipped default template changes.

The alternative of unconditionally registering all templates with ucf, as done
by dh_ucf (1), would copy all templates to /etc/pmg/templates, which I deemed
less elegant.

The postrm script's check for the existance of 'ucf' only should be sufficient,
since the other ucf executables used ('ucfq' and 'ucfr' are all shipped with
the 'ucf' package)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
[ dropped some extra lines left over from v1 ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-14 09:35:07 +02:00

20 lines
405 B
Bash

#!/bin/sh
set -e
if [ "$1" = "purge" ] && command -v ucf >/dev/null 2>&1; then
ucfq -w pmg-api | cut -d : -f 1 | while read -r cfile ; do
ucfr pmg-api --purge "$cfile"
ucf --purge "$cfile"
for ext in .ucf-new .ucf-old .ucf-dist ""; do
rm -f "${cfile}${ext}"
done
done
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#