Your IP : 18.216.71.206


Current Path : /var/lib/dpkg/info/
Upload File :
Current File : /var/lib/dpkg/info/bind9.postinst

#!/bin/sh

set -e

if [ "$1" = configure ]; then
    # lets give them a bind user/group in all cases.
    getent group bind >/dev/null 2>&1 || addgroup --system bind
    getent passwd bind >/dev/null 2>&1 ||
	adduser --system --home /var/cache/bind --no-create-home \
		--disabled-password --ingroup bind bind

    # create data directory on fresh install
    if [ -z "$2" ]; then
	mkdir -p /var/lib/bind
	chown root:bind /var/lib/bind
	chmod 775 /var/lib/bind
    fi

    if [ ! -s /etc/bind/rndc.key ] && [ ! -s /etc/bind/rndc.conf ]; then
	rndc-confgen -a
    fi

    uid=$(ls -ln /etc/bind/rndc.key | awk '{print $3}')
    if [ "$uid" = "0" ]; then
	chown bind /etc/bind/rndc.key
	chgrp bind /etc/bind
	chmod g+s /etc/bind
	chgrp bind /etc/bind/rndc.key /var/cache/bind
	chgrp bind /etc/bind/named.conf* || true
	chmod g+r /etc/bind/rndc.key /etc/bind/named.conf* || true
	chmod g+rwx /var/cache/bind
    fi
fi

# Automatically added by dh_apparmor/3.0.4-2ubuntu2.4
if [ "$1" = "configure" ]; then
    APP_PROFILE="/etc/apparmor.d/usr.sbin.named"
    if [ -f "$APP_PROFILE" ]; then
        # Add the local/ include
        LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.sbin.named"

        test -e "$LOCAL_APP_PROFILE" || {
            mkdir -p `dirname "$LOCAL_APP_PROFILE"`
            install --mode 644 /dev/null "$LOCAL_APP_PROFILE"
        }

        # Reload the profile, including any abstraction updates
        if aa-enabled --quiet 2>/dev/null; then
            apparmor_parser -r -T -W "$APP_PROFILE" || true
        fi
    fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# In case this system is running systemd, we need to ensure that all
	# necessary tmpfiles (if any) are created before starting.
	if [ -z "${DPKG_ROOT:-}" ] && [ -d /run/systemd/system ] ; then
		systemd-tmpfiles --create named.conf >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installdeb/13.6ubuntu1
dpkg-maintscript-helper mv_conffile /etc/default/bind /etc/default/named 1:9.13.6\~ -- "$@"
dpkg-maintscript-helper mv_conffile /etc/default/bind9 /etc/default/named 1:9.12.0\~ -- "$@"
dpkg-maintscript-helper mv_conffile /etc/init.d/bind /etc/init.d/named 1:9.13.6\~ -- "$@"
dpkg-maintscript-helper mv_conffile /etc/init.d/bind9 /etc/init.d/named 1:9.12.0\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/bind/db.root 1:9.11.4\+dfsg-3\~ -- "$@"
dpkg-maintscript-helper rm_conffile /etc/apparmor.d/local/usr.sbin.named 1:9.11.4\+dfsg-1\~ -- "$@"
# End automatically added section
# Automatically added by dh_installinit/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/named" ]; then
		update-rc.d named defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d --skip-systemd-native named $_dh_action || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if deb-systemd-helper debian-installed 'named-resolvconf.service'; then
		# This will only remove masks created by d-s-h on package removal.
		deb-systemd-helper unmask 'named-resolvconf.service' >/dev/null || true

		if deb-systemd-helper --quiet was-enabled 'named-resolvconf.service'; then
			# Create new symlinks, if any.
			deb-systemd-helper enable 'named-resolvconf.service' >/dev/null || true
		fi
	fi

	# Update the statefile to add new symlinks (if any), which need to be cleaned
	# up on purge. Also remove old symlinks.
	deb-systemd-helper update-state 'named-resolvconf.service' >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		deb-systemd-invoke $_dh_action 'named-resolvconf.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'named.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'named.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'named.service' >/dev/null || true
	else
		# Update the statefile to add new symlinks (if any), which need to be
		# cleaned up on purge. Also remove old symlinks.
		deb-systemd-helper update-state 'named.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/13.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		deb-systemd-invoke $_dh_action 'named.service' >/dev/null || true
	fi
fi
# End automatically added section


exit 0