Hi,
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
prometheus-alertmanager
prometheus-apache-exporter
prometheus-bind-exporter
prometheus-ipmi-exporter
prometheus-libvirt-exporter
prometheus-mqtt-exporter
prometheus-mysqld-exporter
prometheus-nginx-exporter
prometheus-node-exporter
prometheus-node-exporter-collectors
prometheus-postgres-exporter
prometheus-process-exporter
prometheus-pushgateway
prometheus-redis-exporter
prometheus-snmp-exporter
---------------
/var/log/prometheus/prometheus-alertmanager.log {
weekly
rotate 10
copytruncate
compress
delaycompress
notifempty
missingok
}
---------------------
#!/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#
Alexandre Detiste: 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. 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