Code

rules: Disabled the tokyotyrant and zfs_arc plugins.
[pkg-collectd.git] / debian / collectd.postinst
index d34dee4a7544fc428b13da799d121c569c0c1a3a..4912af44d583be24082663c3623121809bc4823b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 # postinst script for collectd
 #
 # see: dh_installdeb(1)
@@ -23,8 +23,22 @@ case "$1" in
     configure)
         db_get collectd/auto-migrate-3-4
         if [ "$RET" = "true" ]; then
+            tmpdir=`mktemp -dt collectd.XXXXXXXXXX`
+            hostname=`hostname`
+
+            if [ -z "$hostname" ]; then hostname="localhost"; fi
+
             cp -a /var/lib/collectd/ /var/backups/collectd-"$2"
-            /usr/lib/collectd/utils/migrate-3-4.px | bash
+            /usr/lib/collectd/utils/migrate-3-4.px \
+                --hostname="$hostname" --outdir="$tmpdir" | bash
+
+            rm -rf /var/lib/collectd/
+            mkdir /var/lib/collectd/
+            mv $tmpdir /var/lib/collectd/rrd
+            chmod 0755 /var/lib/collectd/rrd
+
+            # this is only available on Solaris using libkstat
+            rm -f /var/lib/collectd/rrd/$hostname/swap/swap-reserved.rrd
         fi
     ;;