#!/bin/bash
set -e

readonly MODULES_DEBUG_LEVELS_PATH="/var/lib/deepin-debug-config/deepin-debug-levels.cfg"
readonly MODULES_DEBUG_LEVELS_PATH_OLD_VERSION="/usr/share/deepin-debug-config/deepin-debug-levels.cfg"

function rm_file_if_exists {
    if [ -f "$1" ]; then
		rm -f "$1"
	fi
}

function rm_level_cfg {
	rm_file_if_exists "$MODULES_DEBUG_LEVELS_PATH"
    rm_file_if_exists "$MODULES_DEBUG_LEVELS_PATH_OLD_VERSION"
}

function set_debug_off {
	/usr/bin/deepin-debug-config --set -m all -l warning
}

case "$1" in
	configure)
        rm_level_cfg
        set_debug_off || true
	;;
	*)
	;;
esac

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

exit 0

