# Copyright (C) 2011 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of django-debian.
#
# django-debian is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation
#
# django-debian is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with django-debian.  If not, see <http://www.gnu.org/licenses/>.


# Source common django-debian stuff
if [ -f /usr/share/django-debian/dpkg/common ]; then
    . /usr/share/django-debian/dpkg/common
fi


_django_debian_dbc_go() {
    # Load dbconfig-common if it was requested
    if [ "$django_debian_use_dbconfig_common" = "yes" ]; then
        # Source dbconfig-common shell library and call the hook function
        if [ -f /usr/share/dbconfig-common/dpkg/prerm ]; then
            . /usr/share/dbconfig-common/dpkg/prerm
            dbc_go $@
        fi
    fi

}


django_debian_go() {
    _django_debian_debug "starting prerm script: $@"

    # Setup configuration variables
    _django_debian_config $@

    # Deconfigure web server specific files
    _django_debian_deconfigure_web_server_prerm

    # Run dbconfig-common integration
    _django_debian_dbc_go $@
}
