postinst is in pdns-server 4.0.0~alpha2-3build1.
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | #!/bin/sh
#
# postinst script for pdns-server
set -e
if [ -n "$PDNSDEBUG" ]; then
echo "now debugging $0 $@"
set -x
fi
PKGNAME="pdns-server"
PDNSCONF=/etc/powerdns/pdns.conf
PDNSDEFAULT=/etc/default/pdns
PDNSDIR=/etc/powerdns/pdns.d
PDNSLOCAL=$PDNSDIR/pdns.local.conf
# Temporary files
PDNSCONFTEMP=`mktemp`
PDNSLOCALTEMP=`mktemp`
PDNSDEFAULTTEMP=`mktemp`
# 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 $sourcefile $newname
ucfr $PKGNAME $newname
rm -f $newname
fi
}
case "$1" in
configure)
if [ -z "`getent group pdns`" ]; then
addgroup --quiet --system pdns
fi
if [ -z "`getent passwd pdns`" ]; then
echo -n "Creating user and group pdns..."
adduser --quiet --system --home /var/spool/powerdns --shell /bin/false --ingroup pdns --disabled-password --disabled-login --gecos "PowerDNS" pdns
echo "done"
fi
# this can be removed once we do not have to update from
# wheezy (pdns 3.1) any more. Note: there was never pdns 3.2 in Debian
if [ -n "$2" ] && dpkg --compare-versions "$2" lt 3.3; then
renameconffile $PDNSDIR/pdns.local $PDNSDIR/pdns.local.conf $PDNSLOCALTEMP
renameconffile $PDNSDIR/pdns.simplebind $PDNSDIR/pdns.simplebind.conf /usr/share/pdns-server/pdns.simplebind.conf
fi
# register configuration files with ucf
ucfr $PKGNAME $PDNSCONF
ucfr $PKGNAME $PDNSDEFAULT
ucfr $PKGNAME $PDNSLOCAL
ucfr $PKGNAME $PDNSDIR/pdns.simplebind.conf
# Install the new configuration files if the user wants it.
ucf /usr/share/pdns-server/pdns.conf $PDNSCONF
ucf /usr/share/pdns-server/pdns $PDNSDEFAULT
ucf /usr/share/pdns-server/pdns.local.conf $PDNSLOCAL
ucf /usr/share/pdns-server/pdns.simplebind.conf $PDNSDIR/pdns.simplebind.conf
# There could be passwords in these files. PowerDNS first reads the
# configuration files and then drop root privileges.
if [ -z "$2" ]; then
[ -e $PDNSCONF ] && chmod 0600 $PDNSCONF
[ -e $PDNSLOCAL ] && chmod 0600 $PDNSLOCAL
[ -d $PDNSDIR ] && chmod 0755 $PDNSDIR
[ -e $PDNSDEFAULT ] && chmod 0644 $PDNSDEFAULT
fi
# If we still have the default config, make sure bindbackend.conf exists
PDNSBIND="/etc/powerdns/pdns.d/pdns.simplebind.conf"
PDNSBINDBACKENDCONF="/etc/powerdns/bindbackend.conf"
if [ -e "$PDNSBIND" ]; then
if grep -q "^bind-config=$PDNSBINDBACKENDCONF$" $PDNSBIND; then
touch $PDNSBINDBACKENDCONF
fi
fi
;;
triggered)
invoke-rc.d pdns restart || exit $?
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Recover from incorrect init.d script headers in version 2.9.22-1 and earlier
if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le "2.9.22-1" \
&& [ -f /etc/rc0.d/K[0-9][0-9]pdns ] \
&& ! [ -f /etc/rc1.d/K[0-9][0-9]pdns ]; then
update-rc.d -f pdns remove
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_systemd_enable
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask pdns.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled pdns.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable pdns.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state pdns.service >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installinit
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
if [ -x "/etc/init.d/pdns" ]; then
update-rc.d pdns defaults >/dev/null
fi
if [ -x "/etc/init.d/pdns" ] || [ -e "/etc/init/pdns.conf" ]; then
invoke-rc.d pdns start || exit $?
fi
fi
# End automatically added section
exit 0
|