This file is indexed.

postinst is in puppet-master 5.4.0-2ubuntu3.

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
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
#!/bin/sh

set -e

OLDCONFS="/etc/logrotate.d/puppetmaster /etc/init.d/puppetmaster /etc/default/puppetmaster"

if [ "$1" = "configure" ] && [ -z "$2" ]; then
    # Check if puppetmaster.service's state file is still around, i.e. if
    # puppetmaster was installed and has not been purged.
    if deb-systemd-helper debian-installed puppetmaster.service; then
        if ! deb-systemd-helper --quiet was-enabled puppetmaster.service; then
            # This is a "fresh" install, i.e. pulled in as a dependency of
            # puppetmaster. Skip enabling puppet-master.service if puppetmaster
            # was not enabled
            deb-systemd-helper unmask puppet-master.service >/dev/null || true
            deb-systemd-helper update-state puppet-master.service >/dev/null || true
            update-rc.d puppet-master defaults >/dev/null || true
            update-rc.d puppet-master disable >/dev/null || true
        fi
        deb-systemd-helper purge puppetmaster.service >/dev/null || true
        deb-systemd-helper unmask puppetmaster.service >/dev/null || true
    fi

    # Check if puppetmaster is in the unpacked state
    if dpkg-query -W --showformat '${Status}\n' puppetmaster | grep -q unpacked; then
        puppetmaster_state="unpacked"
    fi

    for conffile in $OLDCONFS; do
        newname="$(echo $conffile | sed -e 's/puppetmaster/puppet-master/')"
        to_copy=""

        if [ "$puppetmaster_state" = "unpacked" -a -e "$conffile.dpkg-backup" ]; then
            # Case 1: puppetmaster is in the unpacked state; we want to see whether
            # dpkg-maintscript-helper has created a .dpkg-backup
            to_copy="$conffile.dpkg-backup"
        elif [ -e "$conffile" ]; then
            # Case 2: puppetmaster is still around and owns the conffile
            md5sum="$(md5sum "$conffile" | sed -s 's/ .*//')"
            old_md5sum="$(dpkg-query -W -f='${Conffiles}' puppetmaster | \
                            sed -n -e "\'^ $conffile ' { s/ obsolete$//; s/.* //; p }")"
            if [ -n "$old_md5sum" -a "$md5sum" != "$old_md5sum" ]; then
                to_copy="$conffile"
            fi
        fi


        if [ -n "$to_copy" ]; then
            md5sum="$(md5sum ${newname} | sed -e 's/ .*//')"
            old_md5sum="$(dpkg-query -W -f='${Conffiles}' puppet-master | \
                                sed -n -e "\' ${newname} ' { s/ obsolete$//; s/.* //; p }")"

            if [ "$md5sum" = "$old_md5sum" ]; then
                echo "Preserving user changes from $conffile in $newname; $newname saved as $newname.dpkg-new"
                if [ -e "$newname" ]; then
                    mv -f "$newname" "$newname.dpkg-new"
                fi

                cp "$to_copy" "$newname"

                if [ "$newname" = "/etc/logrotate.d/puppet-master" ]; then
                    # Migrate logrotate's pkill command to the new process name
                    sed -i -e 's/pkill \(.*\) -f puppetmasterd/pkill \1 -f "puppet master"/' "$newname"
                fi
            fi
        fi
    done
fi

# Purge the old puppetmaster symlinks from /etc/rcX.d
update-rc.d -f puppetmaster remove >/dev/null || true

# Automatically added by dh_installinit/11.1.6ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/puppet-master" ]; then
		update-rc.d puppet-master defaults >/dev/null
		if [ -n "$2" ]; then
			_dh_action=restart
		else
			_dh_action=start
		fi
		invoke-rc.d puppet-master $_dh_action || exit 1
	fi
fi
# End automatically added section
# Automatically added by dh_installsystemd/11.1.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 'puppet-master.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'puppet-master.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'puppet-master.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 'puppet-master.service' >/dev/null || true
	fi
fi
# End automatically added section