#!/bin/sh
# postinst script for ezmlm-idx
set -e

sysconfdir=/etc/indimail

case "$1" in
    configure)
    ;;

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

	*)
	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#
mkdir -p ${sysconfdir}/ezmlm/global_vars
if [ -d ${sysconfdir}/control/global_vars ] ; then
  if [ ! -L ${sysconfdir}/ezmlm/global_vars/.envdir -a ! -f ${sysconfdir}/ezmlm/global_vars/.envdir ] ; then
    ln -srf ${sysconfdir}/control/global_vars ${sysconfdir}/ezmlm/global_vars/.envdir
  fi
  for i in QUEUE_BASE QUEUE_COUNT QUEUE_START
  do
    /bin/rm -f ${sysconfdir}/ezmlm/global_vars/$i
  done
else
  for i in QUEUE_BASE QUEUE_COUNT QUEUE_START
  do
    if [ ! -f ${sysconfdir}/ezmlm/global_vars/$i -a ! -L ${sysconfdir}/ezmlm/global_vars/$i ] ; then
      ln -srf ${sysconfdir}/control/defaultqueue/$i ${sysconfdir}/ezmlm/global_vars/$i
    fi
  done
fi

exit 0
