#!/bin/sh

#DEBHELPER#
# Could be called by DPKG or RPM.
# Handle the cases we want to hook or silently claim success.
case "$1" in
  configure|2)
    : # Fall through to systemctl handle.
    ;;
  *)
    exit 0
    ;;
esac

# Reload daemons
if [ -x /bin/systemctl ] && [ -x /run/systemd/system ] ; then
    /bin/systemctl daemon-reload 2>/dev/null 2>&1
    /bin/systemctl is-active --quiet osqueryd && /bin/systemctl restart osqueryd || true
elif which initctl >/dev/null 2>&1 ; then
    service osqueryd restart
fi
