#!/bin/sh
# postinst script for pkg-arch
#
# see: dh_installdeb(1)

set -e

action="$1"
oldversion="$2"

case "$action" in
    configure)
        usermod -a -G systemd-journal nagios
        chown nagios:nagios /var/lib/nagios
        [ -e /etc/nagios-plugins/config/ssd_config.yaml -a ! -e /etc/nagios-plugins/check_ssd.yaml ] && \
            mv /etc/nagios-plugins/config/ssd_config.yaml /etc/nagios-plugins/check_ssd.yaml
        [ -e /etc/nagios-plugins/config/dmesg.cfg -a ! -e /etc/nagios-plugins/check_dmesg.whitelist ] && \
            mv /etc/nagios-plugins/config/dmesg.cfg /etc/nagios-plugins/check_dmesg.whitelist
        [ -e /etc/nagios-plugins/config/dmesg.local.cfg -a ! -e /etc/nagios-plugins/check_dmesg.local.whitelist ] && \
            mv /etc/nagios-plugins/config/dmesg.local.cfg /etc/nagios-plugins/check_dmesg.local.whitelist
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
