From b96eccf12f067dcbde984548f4f1d371252a7ac9 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 17 May 2012 17:10:00 +0200 Subject: [PATCH] collectd-core.{postrm,templates}: Prompt the user when purging the data dir. This provides an option to keep the data. The question (debconf priority high) defaults to remove the data Closes: #631167 --- debian/changelog | 5 +++++ debian/collectd-core.postrm | 9 +++++++-- debian/collectd-core.templates | 12 ++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6e9630b..c36ac7d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,11 @@ collectd (4.10.7-1) unstable; urgency=low out-dated data files (e.g. RRD files). * debian/control: - Updated to standards-version 3.9.3 -- no changes. + * debian/collectd-core.postrm, debian/collectd-core.templates: + - Prompt the user (debconf priority high) when purging the collected data + providing an option to opt out. The question defaults to remove the + data; thanks to Trent W. Buck for reporting and discussing this + (Closes: #631167). -- Sebastian Harl Thu, 17 May 2012 15:55:39 +0200 diff --git a/debian/collectd-core.postrm b/debian/collectd-core.postrm index 23ce154..cdeabe4 100755 --- a/debian/collectd-core.postrm +++ b/debian/collectd-core.postrm @@ -20,10 +20,15 @@ set -e case "$1" in purge) - rm -rf /var/lib/collectd + db_input high collectd/postrm_purge_data || true + db_go || true + db_get collectd/postrm_purge_data || true + if [ "$RET" = "true" ]; then + rm -rf /var/lib/collectd + fi rm -rf /etc/collectd ;; - + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; diff --git a/debian/collectd-core.templates b/debian/collectd-core.templates index 089e18f..e727097 100644 --- a/debian/collectd-core.templates +++ b/debian/collectd-core.templates @@ -24,3 +24,15 @@ _Description: Automatically try to migrate your RRD files? . See /usr/share/doc/collectd-core/NEWS.Debian for details. +Template: collectd/postrm_purge_data +Type: boolean +Default: true +_Description: Remove all collected data (e.g. RRD files)? + The /var/lib/collectd/ directory which contains the data files containing the + collected statistics is about to be removed. For example, this directory + includes (in the default configuration) all RRD files. + . + If you're purging the collectd package in order to replace it with a more + recent or custom version or if you want to keep the data for further + analysis, the data should be kept. + -- 2.30.2