From: Sebastian Harl Date: Sat, 19 May 2012 15:58:11 +0000 (+0200) Subject: Added debconf queries and code to automatically migrate from v4. X-Git-Tag: collectd-5.1.0-1~15 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=780a7b80abd3773abb00f86a5c4e2995d3b3ecdc;p=pkg-collectd.git Added debconf queries and code to automatically migrate from v4. This is mostly based on the v3 → v4 migration. --- diff --git a/debian/changelog b/debian/changelog index ce51911..26c5329 100644 --- a/debian/changelog +++ b/debian/changelog @@ -36,6 +36,8 @@ collectd (5.1.0-1) unstable; urgency=low - Documented the upgrade from version 4 to 5. * debian/collectd-core.install: - Install migrate-4-5.px. + * debian/collectd-core.{config,postinst,templates}: + - Added debconf queries and code to automatically migrate from v4. -- Sebastian Harl Sat, 19 May 2012 15:13:21 +0200 diff --git a/debian/collectd-core.config b/debian/collectd-core.config index 830f0fd..25b1718 100755 --- a/debian/collectd-core.config +++ b/debian/collectd-core.config @@ -25,6 +25,18 @@ case "$1" in db_go || true fi fi + + db_set collectd/auto-migrate-4-5 false + + if dpkg --compare-versions "$2" lt-nl "5.0.0~"; then + if perl -e '1' 2> /dev/null && rrdtool > /dev/null 2>&1; then + db_input high collectd/auto-migrate-4-5 || true + db_go || true + else + db_input high collectd/migration-4-5 || true + db_go || true + fi + fi ;; reconfigure) diff --git a/debian/collectd-core.postinst b/debian/collectd-core.postinst index 4912af4..0517d15 100755 --- a/debian/collectd-core.postinst +++ b/debian/collectd-core.postinst @@ -40,6 +40,15 @@ case "$1" in # this is only available on Solaris using libkstat rm -f /var/lib/collectd/rrd/$hostname/swap/swap-reserved.rrd fi + + db_get collectd/auto-migrate-4-5 + if [ "$RET" = "true" ]; then + tmpdir=`mktemp -dt collectd.XXXXXXXXXX` + + cp -a /var/lib/collectd/ /var/backups/collectd-"$2" + /usr/lib/collectd/utils/migrate-4-5.px \ + -indir /var/lib/collectd/rrd/ | bash + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/collectd-core.templates b/debian/collectd-core.templates index e727097..f8ab94f 100644 --- a/debian/collectd-core.templates +++ b/debian/collectd-core.templates @@ -24,6 +24,34 @@ _Description: Automatically try to migrate your RRD files? . See /usr/share/doc/collectd-core/NEWS.Debian for details. +Template: collectd/migration-4-5 +Type: note +_Description: Layout of RRD files has changed in version 5.0 + The layout of some RRD files created by collectd has changed since version + 4.x. In order to keep your old data you have to migrate it. This can be done + by using /usr/lib/collectd-core/utils/migrate-4-5.px. + . + This step requires both the perl and the rrdtool packages to be installed, + which is currently not the case. You need to perform the migration manually. + . + See /usr/share/doc/collectd-core/NEWS.Debian and the collectd wiki at + for details. + +Template: collectd/auto-migrate-4-5 +Type: boolean +Default: false +_Description: Automatically try to migrate your RRD files? + The layout of some RRD files created by collectd has changed since version + 4.x. In order to keep your old data you have to migrate it. This can be done + by using /usr/lib/collectd-core/utils/migrate-4-5.px. + . + This step can be done automatically. In this case a backup of + /var/lib/collectd/ is made in /var/backups/. This script is still + experimental, though. Do not expect it to work in all cases. + . + See /usr/share/doc/collectd-core/NEWS.Debian and the collectd wiki at + for details. + Template: collectd/postrm_purge_data Type: boolean Default: true