Code

rules: Fix the arch selection for enabling the gRPC plugin.
[pkg-collectd.git] / debian / collectd-core.postinst
1 #! /bin/sh
2 # postinst script for collectd
3 #
4 # see: dh_installdeb(1)
6 set -e
8 # summary of how this script can be called:
9 #        * <postinst> `configure' <most-recently-configured-version>
10 #        * <old-postinst> `abort-upgrade' <new version>
11 #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12 #          <new-version>
13 #        * <postinst> `abort-remove'
14 #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 #          <failed-install-package> <version> `removing'
16 #          <conflicting-package> <version>
17 # for details, see http://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
20 . /usr/share/debconf/confmodule
22 case "$1" in
23     configure)
24         db_get collectd/auto-migrate-3-4
25         if [ "$RET" = "true" ]; then
26             tmpdir=`mktemp -dt collectd.XXXXXXXXXX`
27             hostname=`hostname`
29             if [ -z "$hostname" ]; then hostname="localhost"; fi
31             cp -a /var/lib/collectd/ /var/backups/collectd-"$2"
32             /usr/lib/collectd/utils/migrate-3-4.px \
33                 --hostname="$hostname" --outdir="$tmpdir" | bash
35             rm -rf /var/lib/collectd/
36             mkdir /var/lib/collectd/
37             mv $tmpdir /var/lib/collectd/rrd
38             chmod 0755 /var/lib/collectd/rrd
40             # this is only available on Solaris using libkstat
41             rm -f /var/lib/collectd/rrd/$hostname/swap/swap-reserved.rrd
42         fi
44         db_get collectd/auto-migrate-4-5
45         if [ "$RET" = "true" ]; then
46             cp -a /var/lib/collectd/ /var/backups/collectd-"$2"
47             /usr/lib/collectd/utils/migrate-4-5.px \
48                 --rrdfilter /usr/lib/collectd/utils/rrd_filter.px \
49                 --rrdtool /usr/bin/rrdtool \
50                 --indir /var/lib/collectd/rrd/ | bash
51         fi
52     ;;
54     abort-upgrade|abort-remove|abort-deconfigure)
55     ;;
57     *)
58         echo "postinst called with unknown argument \`$1'" >&2
59         exit 1
60     ;;
61 esac
63 db_stop
65 # dh_installdeb will replace this with shell code automatically
66 # generated by other debhelper scripts.
68 #DEBHELPER#
70 exit 0