This file is indexed.

postinst is in icinga2-common 2.8.1-0ubuntu2.

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
103
104
105
#!/bin/sh
# postinst script for icinga2-common

set -e

setperm() {
    user="$1"
    group="$2"
    mode="$3"
    file="$4"
    shift 4
    # only do something when no setting exists
    if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
      chown "$user":"$group" "$file"
      chmod "$mode" "$file"
    fi
}

is_fresh_install()
{
    if [ -z "$2" ] ; then
        return 0
    fi
    return 1
}

dpkg-maintscript-helper rm_conffile \
   "/etc/bash_completion.d/icinga2" "2.4.1-2~" -- "$@"

case "$1" in
    configure)
        if ! getent passwd nagios > /dev/null ; then
            echo 'Adding system-user for nagios' 1>&2
            adduser --system --group --home /var/lib/nagios \
                    --disabled-login --force-badname nagios > /dev/null
        fi

        # explicitly set permissions on some files that are dependent
        # on the uid/gid of the nagios user, which is dynamically created.
        setperm nagios nagios 0750 /etc/icinga2
        setperm nagios nagios 0700 /etc/icinga2/pki

        setperm nagios adm 2751 /var/log/icinga2
        setperm nagios adm 2751 /var/log/icinga2/compat
        setperm nagios adm 2755 /var/log/icinga2/compat/archives
        setperm nagios adm 2751 /var/log/icinga2/crash

        setperm nagios nagios 0750 /var/lib/icinga2
        setperm nagios nagios 0750 /var/lib/icinga2/api
        setperm nagios nagios 0750 /var/lib/icinga2/api/log
        setperm nagios nagios 0750 /var/lib/icinga2/api/repository
        setperm nagios nagios 0750 /var/lib/icinga2/api/zones

        setperm nagios www-data 0750 /var/cache/icinga2

        setperm nagios nagios 0750 /var/spool/icinga2
        setperm nagios nagios 0770 /var/spool/icinga2/perfdata
        setperm nagios nagios 0750 /var/spool/icinga2/tmp

    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

init_failed ()
{
    echo "Icinga 2 was unable to start due to configuration errors.";
    echo "Please fix them and manually restart the icinga2 daemon using";
    echo " ´service icinga2 start´";
}

# Automatically added by dh_systemd_enable/11.1.4ubuntu1
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 'icinga2.service' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'icinga2.service'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'icinga2.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 'icinga2.service' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installinit/11.1.4ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -x "/etc/init.d/icinga2" ]; then
		update-rc.d icinga2 defaults >/dev/null
		invoke-rc.d icinga2 start || exit 1
	fi
fi
# End automatically added section


exit 0