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
|
#!/bin/sh
set -e
if ([ "$1" = "configure" ] && [ -z "$2" ]) || [ -n "$DEBCONF_RECONFIGURE" ]; then
# If /etc/bind/maas is empty, set_up_dns.
if [ ! "$(ls -A /etc/bind/maas)" ]; then
maas-region-admin set_up_dns
fi
# Fix permissions.
if [ -d /etc/bind/maas ]; then
chown -R maas:root /etc/bind/maas
fi
if [ -f /etc/bind/maas/named.conf.maas ]; then
chmod 644 /etc/bind/maas/named.conf.maas
fi
if [ -f /etc/bind/maas/rndc.conf.maas ]; then
chmod 600 /etc/bind/maas/rndc.conf.maas
fi
if [ -f /etc/bind/maas/named.conf.rndc.maas ]; then
chown maas:bind /etc/bind/maas/named.conf.rndc.maas
chmod 640 /etc/bind/maas/named.conf.rndc.maas
fi
# Remove any existing MAAS-related include line from
# /etc/bind/named.conf.local, then re-add it.
sed -i '/^include\s.*maas/d' /etc/bind/named.conf.local
maas-region-admin get_named_conf --edit --config_path /etc/bind/named.conf.local
# Add a line in /etc/bind/named.conf.options that includes the
# /etc/named/maas/named.conf.options.inside.maas file.
maas-region-admin edit_named_options --config-path /etc/bind/named.conf.options
invoke-rc.d bind9 restart || true
fi
if [ "$1" = "configure" ]; then
# If the /etc/bind/named.conf.options is not set up yet, do it now.
# This might happen because of an upgrade from an older package.
if ! grep -qs "named.conf.options.inside.maas" /etc/bind/named.conf.options; then
maas-region-admin edit_named_options --config-path /etc/bind/named.conf.options
invoke-rc.d bind9 restart || true
fi
fi
#DEBHELPER#
|