#!/bin/sh
#----------------------------------------------------------------------------
# /var/install/deinstall/asterisk-pgsql - deinstall script
#
# Creation   :  2019-05-20 holbru
# Last update:  $Id$
#
# Copyright (c) 2019-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------

# set package name
package_name=asterisk-pgsql

# set filelist
filelist=/etc/filelist.d/${package_name}-files.txt

# check for update is given
if [ "${1}" = "--update" ]
then
    update=true
fi

# ---------------------------------------------------------------------------
# stop for update only
# ---------------------------------------------------------------------------
if ${update:-false}
then
    exit 0
fi

config_path='/etc/asterisk'
config_file='cdr_pgsql cel_pgsql res_pgsql'

for _conf in ${config_file}
do
    rm -f ${config_path}/${_conf}.conf
done
rmdir --ignore-fail-on-non-empty ${config_path} 2>/dev/null

exit 0
# ---------------------------------------------------------------------------
# end
# ---------------------------------------------------------------------------