This file is indexed.

postinst is in pdns-server 3.0-1.1ubuntu1.

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
#!/bin/sh
#
# postinst script for pdns-server

set -e

# Load debconf
. /usr/share/debconf/confmodule

PDNSCONF=/etc/powerdns/pdns.conf
PDNSDEFAULT=/etc/default/pdns
if [ -e $PDNSCONF ]; then
  PDNSDIR=`cat $PDNSCONF | grep include | awk -F '=' '{print $2}'`
fi
if [ -z "$PDNSDIR" ]; then
  PDNSDIR=/etc/powerdns/pdns.d
fi
PDNSLOCAL=$PDNSDIR/pdns.local

# Temporary files
PDNSCONFTEMP=`mktemp`
PDNSLOCALTEMP=`mktemp`
PDNSDEFAULTTEMP=`mktemp`

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

    # Fill the temporary files with config items.
    cat /usr/share/pdns-server/pdns.conf > $PDNSCONFTEMP
    cat /usr/share/pdns-server/pdns.local > $PDNSLOCALTEMP
    cat /usr/share/pdns-server/pdns > $PDNSDEFAULTTEMP

    # Do we listen on a specified address
    db_get pdns-server/localaddress || true
    if [ ! -z "$RET" ]; then
      sed -i -e "s|^\(#\)\?\(# \)\?local-address=.*$|local-address=$RET|" $PDNSCONFTEMP
    fi

    # Allow recursion subnets ?
    db_get pdns-server/allowrecursion || true
    if [ ! -z "$RET" ]; then
      sed -i -e "s|^\(#\)\?\(# \)\?allow-recursion=.*$|allow-recursion=$RET|" $PDNSCONFTEMP
    fi

    # Start on boot ?
    db_get pdns-server/autostart || true
    [ -z "$RET" ] && RET=false
    if [ "$RET" = "true" ]; then
      sed -i -e "s/^START=.*$/START=yes/" $PDNSDEFAULTTEMP
    fi

    # Install the new configuration files if the user wants it.
    ucf --debconf-ok $PDNSCONFTEMP $PDNSCONF
    ucf --debconf-ok $PDNSDEFAULTTEMP $PDNSDEFAULT
    ucf --debconf-ok $PDNSLOCALTEMP $PDNSLOCAL

    # Stop the debconf stuff
    db_stop || true

    # Clean up temporary files.
    rm -f $PDNSCONFTEMP $PDNSDEFAULTTEMP $PDNSLOCALTEMP

    # There could be passwords in these files. PowerDNS first reads the
    # configuration files and then drop root privileges.
    if [ -z "$2" ]; then
      chmod 0600 $PDNSCONF $PDNSLOCAL
      chmod 0700 $PDNSDIR
    fi
  ;;

  triggered)
    if [ -x /usr/sbin/invoke-rc.d ]; then
      invoke-rc.d pdns restart || exit $?
    else
      /etc/init.d/pdns restart || exit $?
    fi

    # Stop the debconf stuff
    db_stop || true
  ;;

  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

if [ "$1" = "configure" ] && [ -x "/etc/init.d/pdns" ]; then
  update-rc.d pdns defaults 20 85 >/dev/null || exit 0
fi

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



exit 0