postinst is in bacula-director-pgsql 5.2.6+dfsg-9.1ubuntu3.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #!/bin/sh
# postinst script for bacula-director-pgsql
#
set -e
. /usr/share/debconf/confmodule
db_version 2.0
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
# quoting from the policy:
# Any necessary prompting should almost always be confined to the
# post-installation script, and should be protected with a conditional
# so that unnecessary prompting doesn't happen if a package's
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
dbc_first_version=1.38.9-2
# set in config, must not be set here: dbc_dbuser=bacula
# set in config, must not be set here: dbc_dbname=bacula
if test "$1" = "configure" -a -n "$2" && dpkg --compare-versions "$2" lt "5.2.6+dfsg-1"; then
invoke-rc.d bacula-director stop || true
fi
# source dbconfig-common shell library, and call the hook function
if [ -f /usr/share/dbconfig-common/dpkg/postinst.pgsql ]; then
. /usr/share/dbconfig-common/dpkg/postinst.pgsql
dbc_pgsql_createdb_encoding="SQL_ASCII"
dbc_sql_substitutions="1"
dbc_go bacula-director-pgsql $@
fi
LOGDIR="/var/log/bacula"
POSTINST_COMMON="/usr/share/bacula-director/postinst-common"
DEFCONFIG="/usr/share/bacula-common/defconfig"
CFGFILE="/etc/bacula/bacula-dir.conf"
CATALOG=bacula
PGSQL=/usr/bin/psql
GRANT_SQL_PRIVS="/usr/share/bacula-director/grant_pgsql_privileges"
AUTHFILE=`getent passwd bacula | cut -d ':' -f 6`/.pgpass
. /usr/share/bacula-common/common-functions.dpkg
readOrCreatePasswords
setup_etc_default bacula-director-pgsql $@
case "$1" in
configure)
check_and_fix_unsafe_director_password bacula-director-pgsql
echo -n "Processing configuration..."
. /etc/dbconfig-common/bacula-director-pgsql.conf
TARGET=$CFGFILE.dpkg-tmp
if [ "$dbc_install" = "true" ] ; then
sed -e "s/make_catalog_backup bacula bacula/make_catalog_backup -h '$dbc_dbserver' -U $dbc_dbuser/" \
-e "s/dbname = \"XXX_DBNAME_XXX\";/dbname = \"$dbc_dbname\"; DB Address = \"$dbc_dbserver\";/" \
-e "s~/XXX_DBNAME_XXX~/$dbc_dbname~" \
-e "s/XXX_DBUSER_XXX/$dbc_dbuser/" -e "s/XXX_DBPASSWORD_XXX/$dbc_dbpass/" \
-e s~XXX_DIRPASSWORD_XXX~$DIRPASSWD~ \
-e s~XXX_MONDIRPASSWORD_XXX~$DIRMPASSWD~ \
-e s~XXX_SDPASSWORD_XXX~$SDPASSWD~ \
-e s~XXX_FDPASSWORD_XXX~$FDPASSWD~ \
$DEFCONFIG/bacula-dir.conf > $TARGET
fi
DBNAME="$dbc_dbname"
SUBST_VARIABLES=DBNAME
install_config \
bacula-director-pgsql \
/usr/share/bacula-common/defconfig/scripts/delete_catalog_backup \
/etc/bacula/scripts/delete_catalog_backup
sh $POSTINST_COMMON
echo "Ok."
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Do start daemon
db_stop
invoke-rc.d bacula-director start || exit $?-
exit 0
|