1#!/bin/sh
2
3set -e
4
5# summary of how this script can be called:
6#        * <postinst> `configure' <most-recently-configured-version>
7#        * <old-postinst> `abort-upgrade' <new version>
8#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
9#          <new-version>
10#        * <postinst> `abort-remove'
11#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
12#          <failed-install-package> <version> `removing'
13#          <conflicting-package> <version>
14# for details, see http://www.debian.org/doc/debian-policy/ or
15# the debian-policy package
16
17#set -x
18#echo "bareos-database-common.postinst: $@" >&2
19
20. /usr/share/debconf/confmodule
21
22if [ -r @scriptdir@/bareos-config-lib.sh ]; then
23    . @scriptdir@/bareos-config-lib.sh
24    if [ -f /usr/share/dbconfig-common/dpkg/postinst ]; then
25        . /usr/share/dbconfig-common/dpkg/postinst
26
27        dbc_debug=1
28
29        # action
30        if [ $# -gt 0 ]; then
31            param1="$1"
32            shift
33        fi
34        # when action is "configure": most-recently-configured-version
35        if [ $# -gt 0 ]; then
36            param2="$1"
37            shift
38        fi
39        if [ "$param2" ]; then
40            case "$param1" in
41                configure|reconfigure)
42                    param2=`get_database_version_by_release "$param2"`
43                    ;;
44                *)
45                    ;;
46            esac
47        fi
48
49        # dbc_pgsql_createdb_encoding: required for postgresql
50        dbc_pgsql_createdb_encoding="SQL_ASCII"
51
52        # dbc_dbfile_owner: only required for sqlite3
53        dbc_dbfile_owner=`get_user_dir`:`get_group_dir`
54
55        # substitution is only done on installs, not on updates!
56        #dbc_sql_substitutions="yes"
57
58        # run dbconfig
59        dbc_go bareos-database-common $param1 $param2 $@
60
61        # apply the dbconfig settings, ignore errors
62        @scriptdir@/bareos-config apply_dbconfig_settings || true
63    fi
64fi
65
66#DEBHELPER#
67