X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=debian%2Fcollectd.postinst;h=99bfabf4279d96d30892926100d747c0f516e403;hb=46c00318c02c4109238fb574d74d2c5d5c45ae0f;hp=4912af44d583be24082663c3623121809bc4823b;hpb=5a8a3680216f78278a80c4a9cdd6fbab97498503;p=pkg-collectd.git diff --git a/debian/collectd.postinst b/debian/collectd.postinst old mode 100755 new mode 100644 index 4912af4..99bfabf --- a/debian/collectd.postinst +++ b/debian/collectd.postinst @@ -17,41 +17,24 @@ set -e # 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 - 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 \ - --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 - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -db_stop +if [ -x "/etc/init.d/collectd" ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d collectd restart || exit $? + else + /etc/init.d/collectd restart || exit $? + fi +fi + +# replace the directory provided by older versions of the package with a +# symlink; dpkg does not handle that according to policy 6.6 +if [ "$1" = "configure" ] \ + && dpkg --compare-versions "$2" lt-nl "4.10.0-1~"; then + if [ -d "/usr/share/doc/collectd/examples" ]; then + ! rmdir /usr/share/doc/collectd/examples > /dev/null 2>&1 \ + || ln -s ../collectd-core/examples \ + /usr/share/doc/collectd/examples + fi +fi # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. @@ -60,4 +43,3 @@ db_stop exit 0 -