#! /bin/sh

set -e

case "$1" in
  configure)
        for file in /etc/freeradius/sql/postgresql/cisco_h323_db_schema.sql \
          /etc/freeradius/sql/postgresql/counter.conf \
          /etc/freeradius/sql/postgresql/dialup.conf \
          /etc/freeradius/sql/postgresql/ippool.conf \
          /etc/freeradius/sql/postgresql/ippool.sql \
          /etc/freeradius/sql/postgresql/nas.sql \
          /etc/freeradius/sql/postgresql/schema.sql \
          /etc/freeradius/sql/postgresql/update_radacct_group_trigger.sql \
          /etc/freeradius/sql/postgresql/voip-postpaid.conf
        do
          if ! dpkg-statoverride --list | grep -qw $file$; then
            dpkg-statoverride --add --update root freerad 0640 $file
          fi
        done

        for dir in /etc/freeradius/sql \
          /etc/freeradius/sql/postgresql
        do
          if ! dpkg-statoverride --list | grep -qw $dir$; then
            dpkg-statoverride --add --update root freerad 2751 $dir
          fi
        done

        if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
          invoke-rc.d freeradius force-reload
        else
          /etc/init.d/freeradius force-reload
        fi
	;;
esac

#DEBHELPER#

exit 0



