This file is indexed.

postinst is in nsd 4.0.1-1.

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
60
61
62
#!/bin/sh
set -e

# Automatically added by dh_installinit
if [ -x "/etc/init.d/nsd" ] || [ -e "/etc/init/nsd.conf" ]; then
	if [ ! -e "/etc/init/nsd.conf" ]; then
		update-rc.d nsd defaults >/dev/null
	fi
	invoke-rc.d nsd start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f nsd remove >/dev/null || exit $?
# End automatically added section


if test "$1" = "configure"; then
    # Move /etc/nsd3/nsd.conf to /etc/nsd/nsd.conf on first install of NSD 4
    OLDCONFFILE=/etc/nsd3/nsd.conf
    NEWCONFFILE=/etc/nsd/nsd.conf
    if [ -z "$2" ] && [ -f "$OLDCONFFILE" ]; then
	echo "Preserving user changes to $NEWCONFFILE (renamed from $OLDCONFFILE)..."
        mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
        mv -f "$OLDCONFFILE" "$NEWCONFFILE"
    fi

    # Create nsd user and group
    if ! getent passwd nsd > /dev/null; then
        adduser --quiet --system --group --no-create-home --home /var/lib/nsd nsd
    fi

    # Make /var/lib/nsd writeable by nsd:nsd user
    if ! dpkg-statoverride --list /var/lib/nsd >/dev/null; then
        dpkg-statoverride --update --add nsd nsd 0755 /var/lib/nsd >/dev/null 2>/dev/null || true
    fi

    # Cleanup some cruft from prior NSD 4 packaging (it can go away before release)
    if [ -n "$2" ] && dpkg --compare-versions 4.0.0-1~ gt "$2"; then
	dpkg-statoverride --remove /etc/nsd/nsd.conf >/dev/null 2>/dev/null || true
	dpkg-statoverride --remove /etc/nsd >/dev/null 2>/dev/null || true
    fi

    # Remove the old statoverrides from nsd3 package
    for f in /var/lib/nsd3 /etc/nsd3/nsd.conf /etc/nsd3; do
	if dpkg-statoverride --list "$f" >/dev/null; then
	    dpkg-statoverride --remove "$f" >/dev/null 2>/dev/null || true
	fi
    done

    # Generate the control certificates if needed
    if ! [ -f /etc/nsd/nsd_control.key ]; then
	nsd-control-setup >/dev/null 2>&1 || true
    fi

    # This is a remedy for purging already removed nsd3 after nsd installation
    nsd3_postrm=$(dpkg-query --control-path nsd3 postrm 2>/dev/null || true)
    if [ -n "$nsd3_postrm" ] && [ -f "$nsd3_postrm" ] && grep -q deluser "$nsd3_postrm"; then
	sed -i -e "/deluser --quiet nsd/ d" "$nsd3_postrm"
    fi
fi

exit 0