summaryrefslogtreecommitdiff
path: root/community/bind-geodns/bind.install
blob: 39ae9f2022065d832a58771a4964f8ee163faa74 (plain)
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
post_install() {
  getent group named  >/dev/null || usr/sbin/groupadd -g 40 named
  getent passwd named >/dev/null || usr/sbin/useradd -u 40 -c "BIND DNS Server" -g named -d /var/named -s /bin/false named
  usr/bin/passwd -l named &>/dev/null

  [ -f var/log/named.log ] || : >var/log/named.log
  chown named.named var/log/named.log
  # create an rndc.key if it doesn't already exist
  if [ ! -s etc/rndc.key ]; then
    usr/sbin/rndc-confgen -b 256 | head -n 5 >>etc/rndc.key
    chown root.named etc/rndc.key
    chmod 640 etc/rndc.key
  fi
}

post_upgrade() {
  post_install $1
  # old versions of this package didn't have a named user
  chown -R named:named var/named
  # old versions of this package didn't set permissions correct
  chown root:named etc/named.conf
  chmod 640 etc/named.conf
}

pre_remove() {
  usr/sbin/userdel named &>/dev/null
  usr/sbin/groupdel named &>/dev/null
}