File: pdns-server.config

package info (click to toggle)
pdns 3.1-4.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 7,356 kB
  • sloc: cpp: 42,003; ansic: 22,326; sh: 18,273; sql: 618; makefile: 590; yacc: 222; lex: 133; perl: 52
file content (48 lines) | stat: -rw-r--r-- 1,088 bytes parent folder | download | duplicates (7)
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
#!/bin/sh
#
# Load several components for debconf configuration

set -e

. /usr/share/debconf/confmodule

PDNSCONF=/etc/powerdns/pdns.conf

db_version 2.0
if [ ! -f $PDNSCONF ]; then
  db_input medium pdns-server/localaddress || true
  db_input medium pdns-server/allowrecursion || true

  db_go || true
else
  LOCAL=`(cat $PDNSCONF | grep "^local-address=" | awk -F '=' '{print $2}') || true`
  RECURSION=`(cat $PDNSCONF | grep "^allow-recursion=" | awk -F '=' '{print $2}') || true`

  # Put multiple lines on one line and separate them by a comma
  REC=""
  for i in $RECURSION; do
    REC="$i,$REC"
  done

  # Remove , on the end of the line
  RECURSION=`echo $REC | sed -e 's/,$//'`

  if [ ! -z "$RECURSION" ]; then
    db_set pdns-server/allowrecursion "$RECURSION"
  else
    db_set pdns-server/allowrecursion "127.0.0.1"
  fi
  if [ ! -z "$LOCAL" ]; then
    db_set pdns-server/localaddress $LOCAL
  else
    db_set pdns-server/localaddress "0.0.0.0"
  fi

  db_fset pdns-server/allowrecursion seen true
  db_fset pdns-server/localaddress seen true
fi

db_stop || true

exit 0