From: Sebastian Harl Date: Sun, 29 Apr 2007 13:57:03 +0000 (+0200) Subject: Added possibility to automatically migrate RRD files from v3 to v4. X-Git-Tag: collectd-4.0.2-1~64 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fa6349ff50c3be59891d166cd51c0d4cf2e0ce92;p=pkg-collectd.git Added possibility to automatically migrate RRD files from v3 to v4. A debconf question has been added to ask the user weather he wishes to let collectd try to automatically migrate old RRD files using migrate-3-4.px. A backup of /var/lib/collectd/ will be created in this case. --- diff --git a/debian/collectd.config b/debian/collectd.config new file mode 100755 index 0000000..09a4703 --- /dev/null +++ b/debian/collectd.config @@ -0,0 +1,38 @@ +#!/bin/sh +# config script for collectd +# +# see: dh_installdebconf(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `configure' +# * `reconfigure' + +. /usr/share/debconf/confmodule + +case "$1" in + configure) + db_set collectd/auto-migrate-3-4 false + + if dpkg --compare-versions "$2" lt "4.0.0~"; then + db_input high collectd/auto-migrate-3-4 || true + db_go || true + fi + ;; + + reconfigure) + ;; + + *) + echo "config called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +db_stop + +exit 0 + + diff --git a/debian/collectd.postinst b/debian/collectd.postinst new file mode 100755 index 0000000..d34dee4 --- /dev/null +++ b/debian/collectd.postinst @@ -0,0 +1,49 @@ +#!/bin/sh +# postinst script for collectd +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +. /usr/share/debconf/confmodule + +case "$1" in + configure) + db_get collectd/auto-migrate-3-4 + if [ "$RET" = "true" ]; then + cp -a /var/lib/collectd/ /var/backups/collectd-"$2" + /usr/lib/collectd/utils/migrate-3-4.px | bash + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +db_stop + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/collectd.templates b/debian/collectd.templates new file mode 100644 index 0000000..e9b8021 --- /dev/null +++ b/debian/collectd.templates @@ -0,0 +1,14 @@ +Template: collectd/auto-migrate-3-4 +Type: boolean +Default: false +Description: Automatically try to migrate your RRD files? + The layout of the RRD files created by collectd has changed significantly + since version 3.x. In order to keep your old data you have to migrate it. + This can be done by using /usr/lib/collectd/utils/migrate-3-4.px. This step + can be done automatically. In this case a backup of /var/lib/collectd/ is + made in /var/backups/. + . + See /usr/share/doc/collectd/README.Debian for details. + . + This script is still experimental. Do not expect it to work in all cases. + diff --git a/debian/control b/debian/control index 423f3fa..0bf2179 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.7.2 Package: collectd Architecture: any -Depends: ${shlibs:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} Suggests: collectd-apache, collectd-mysql, collectd-sensors, collectd-dev, collectd-ping, collectd-dns, collectd-perl,librrds-perl, hddtemp, mbmon Provides: collectd-hddtemp diff --git a/debian/rules b/debian/rules index bfe0592..9d7a0fb 100755 --- a/debian/rules +++ b/debian/rules @@ -112,6 +112,7 @@ binary-arch: build install-arch dh_installdocs -A -a debian/README.Debian AUTHORS README TODO dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \ contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/ + dh_installdebconf -a dh_installinit -a -- defaults 95 dh_installman -a src/collectd.1 src/collectd.conf.5 dh_link -a