Code

collectd.postinst: Set output directory for migrate-3-4.px using mktemp(1).
authorSebastian Harl <sh@tokkee.org>
Mon, 30 Apr 2007 16:10:03 +0000 (18:10 +0200)
committerSebastian Harl <sh@tokkee.org>
Mon, 30 Apr 2007 16:10:03 +0000 (18:10 +0200)
debian/collectd.postinst

index 6a2357fc26fc8a2bf70d1aba356f29ec8ae1b150..82cfa51eaee73deeaab1e3b74f7bb51cd148716f 100755 (executable)
@@ -23,10 +23,13 @@ case "$1" in
     configure)
         db_get collectd/auto-migrate-3-4
         if [ "$RET" = "true" ]; then
+            tmpdir=`mktemp -dt collectd.XXXXXXXXXX`
+
             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 -o $tmpdir | bash
+
             rm -rf /var/lib/collectd/
-            mv /tmp/collectd-4/ /var/lib/collectd/
+            mv $tmpdir /var/lib/collectd/
         fi
     ;;