postinst is in maas-dns 2.0.0~beta3+bzr4941-0ubuntu1.
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 | #!/bin/sh
set -e
edit_named_options() {
# 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 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 edit_named_options --config-path /etc/bind/named.conf.options
}
fix_dns_permissions() {
if [ -d /etc/bind/maas ]; then
chown maas:root /etc/bind/maas
chown -R maas:maas /etc/bind/maas/*
fi
if [ -f /etc/bind/maas/named.conf.maas ]; then
chown maas:maas /etc/bind/maas/named.conf.maas
chmod 644 /etc/bind/maas/named.conf.maas
fi
if [ -f /etc/bind/maas/named.conf.options.inside.maas ]; then
chown maas:maas /etc/bind/maas/named.conf.options.inside.maas
chmod 644 /etc/bind/maas/named.conf.options.inside.maas
fi
if [ -f /etc/bind/maas/rndc.conf.maas ]; then
chown maas:root /etc/bind/maas/rndc.conf.maas
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
}
# This handles installs and re-configuration
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 set_up_dns
fi
# Fix permissions.
fix_dns_permissions
edit_named_options
elif [ "$1" = "configure" ]; then
# Fix permissions
fix_dns_permissions
# ensure that DNS config is included
edit_named_options
fi
invoke-rc.d bind9 restart || true
|