postinst is in pdns-backend-mysql 3.3-2.
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 | #!/bin/sh
#
# postinst script for pdns-backend-mysql
set -e
# Execute dbconfig-common
. /usr/share/debconf/confmodule
if [ -n "$PDNSDEBUG" ]; then
echo "now debugging $0 $@"
set -x
fi
PKGNAME="pdns-backend-gmysql"
# rename ucf-conffile. This was mostly stolen from cacti.postinst after
# a short discussion on debian-mentors, see
# http://lists.debian.org/debian-mentors/2013/07/msg00027.html
# and the following thread. Thanks to Paul Gevers
renameconffile() {
oldname="$1"
newname="$2"
sourcefile="$3"
if [ -f $oldname ] ; then
if [ ! -e $newname ] ; then
mv $oldname $newname
# else: Don't do anything, leave old file in place
fi
ucf --purge $oldname
ucfr --purge $PKGNAME $oldname
elif [ ! -e $newname ] ; then
# The file was removed, we should respect that. Unfortunately, we don't
# have a proper way to tell ucf that for the new location, so we need
# to hack it a bit.
# We only need to do this if the target does not already exist. If the
# target already exists, we can later call ucf straight as there
# is already a version of the file available, althought never
# provided by this package, but we can just propose the new file anyway.
ucf --debconf-ok $sourcefile $newname
ucfr $PKGNAME $newname
rm -f $newname
fi
}
if [ "$1" = "configure" ]; then
if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
renameconffile /etc/powerdns/pdns.d/pdns.local.gmysql /etc/powerdns/pdns.d/pdns.local.gmysql.conf /dev/null
fi
fi
. /usr/share/dbconfig-common/dpkg/postinst.mysql
dbc_first_version="3.0-1"
dbc_generate_include_args="-o template_infile=/usr/share/pdns-backend-mysql/pdns.local.gmysql.conf"
dbc_generate_include=template:/etc/powerdns/pdns.d/pdns.local.gmysql.conf
dbc_generate_include_owner=pdns
dbc_generate_include_perms=0640
dbc_go pdns-backend-mysql $@
# Activate trigger
dpkg-trigger pdns-server
ucfr $PKGNAME /etc/powerdns/pdns.d/pdns.local.gmysql.conf
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0
|