Code

collectd.postinst: Pass hostname to migrate-3-4.px and fix new DataDir.
authorSebastian Harl <sh@tokkee.org>
Tue, 1 May 2007 21:10:42 +0000 (23:10 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 2 May 2007 18:00:53 +0000 (18:00 +0000)
* hostname should only default to "localhost" if hostname(1) returned the
  empty string
* move new DataDir to /var/lib/collectd/rrd instead of /var/lib/collectd/

debian/collectd.postinst

index 82cfa51eaee73deeaab1e3b74f7bb51cd148716f..b9b5b142b95e2619348ff17936e9035b476ff7f8 100755 (executable)
@@ -24,12 +24,17 @@ case "$1" in
         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 -o $tmpdir | bash
+            /usr/lib/collectd/utils/migrate-3-4.px \
+                --hostname="$hostname" --outdir="$tmpdir" | bash
 
             rm -rf /var/lib/collectd/
-            mv $tmpdir /var/lib/collectd/
+            mkdir /var/lib/collectd/
+            mv $tmpdir /var/lib/collectd/rrd
         fi
     ;;