#!/bin/sh

/opt/puppetlabs/server/apps/puppetdb/scripts/install.sh postinst_deb

# Set some configuration from the project on install
if [ -z "$2" ]; then
  /opt/puppetlabs/server/apps/puppetdb/scripts/install.sh postinst_deb_install
fi

# On upgrade, we should restart the service if it's running
if [ $1 = 'configure' -a -n $2 ] ; then
  if [ -d '/run/systemd/system' ] ; then
    # Using systemd
    systemctl daemon-reload >/dev/null 2>&1 || :
    systemctl try-restart puppetdb.service ||:
  fi
fi

# Run trigger scripts on install if defined
if [ $1 = triggered ] && [ -z $2 ]; then
    : # in case there are no install triggers
fi

# Run trigger scripts on upgrade if defined
if [ $1 = triggered ] && [ -n $2 ]; then
    : # in case there are no upgrade triggers
fi
