Alexandre Detiste:
Package: debhelper Version: 13.31 Severity: wishlistHi, I'm looking at a slew of prometheus- packages that have all the same very formulaic postrm script and logrote config. Could dh_installlogrotate be made smarter and peek inside the snippets and from those generate matching postrm/purge scripts to rotate the files in the void on purge ? Greetings Alexandre
Hi Alexandre, Thanks for the suggestion.The literal suggestion is unfortunately not a good match to debhelper, as it would require too complex logic compared to what debhelper (by its core design choice) is willing to commit to a given helper. Additionally, it would only cover 1 of the 3 statements in the shown postrm file, so it is not going to remove the need for a manual postrm anyhow.
[...]
---------------------
#!/bin/sh
# postrm script for prometheus
# Script executed after the package is removed.
set -e
case "$1" in
purge)
rm -rf /var/log/prometheus/prometheus-alertmanager.log* \
/run/prometheus/prometheus-alertmanager.pid \
/var/lib/prometheus/alertmanager/
# We do NOT remove the system user.
;;
esac
#DEBHELPER#
Looking at this some more, I feel it is more or less 1:1 with `debputy`'s `clean-after-removal` feature. That might be easier to do for `debhelper` to add a `dh_cleanafterremoval` helper that reads patterns from a file.
Best regards, Niels
OpenPGP_signature.asc
Description: OpenPGP digital signature

