#!/bin/sh -e
#DEBHELPER#

# must match src/pmmgr/GNUmakefile
chown pcp:pcp /var/log/pcp/pmmgr
chmod 775 /var/log/pcp/pmmgr

do_systemd=true
which deb-systemd-helper >/dev/null 2>&1 || do_systemd=false
[ -f /lib/systemd/system/pmmgr.service ] || do_systemd=false

# Note: default pmlogger and pmie setups are guaranteed to be
# installed also, so pmmgr disabled by default on deb install

if $do_systemd
then
   :
   # deb-systemd-helper enable pmmgr.service >/dev/null
elif which update-rc.d >/dev/null 2>&1
then
    update-rc.d -f pmmgr remove >/dev/null
    update-rc.d pmmgr defaults >/dev/null
fi

#if which invoke-rc.d >/dev/null 2>&1
#then
#    invoke-rc.d pmmgr start
#else
#    /etc/init.d/pmmgr start
#fi
