postinst is in icingaweb2 2.1.0-1ubuntu1.
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  | #!/bin/sh
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
}
case "$1" in
    configure)
        if ! getent group icingaweb2 > /dev/null ; then
            echo 'Adding system-group for icingaweb2' 1>&2
            addgroup --system icingaweb2 >/dev/null
        fi
        # secure configuration directory and allow config access
        setperm root icingaweb2 2770 /etc/icingaweb2
        COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
        if ! getent group icingaweb2 | grep -q www-data; then
            adduser www-data icingaweb2
        fi
        # NEW method for Apache >= 2.4
        if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
            . /usr/share/apache2/apache2-maintscript-helper
            apache2_invoke enmod rewrite
            apache2_invoke enconf icingaweb2
            # remove OLD Apache 2.2 link
            [ -L /etc/apache2/conf.d/icingaweb2.conf ] && rm /etc/apache2/conf.d/icingaweb2.conf
        # OLD methods for Apache < 2.4
        elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
            # enable mod rewrite
            [ -e /etc/apache2/mods-enabled/rewrite.load ] || a2enmod rewrite
            # create symlink if not existing
            [ -e /etc/apache2/conf.d/icingaweb2.conf ] || ln -vs ../conf-available/icingaweb2.conf /etc/apache2/conf.d/icingaweb2.conf
            # reload webserver
            [ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload
        fi
    ;;
    abort-upgrade|abort-remove|abort-deconfigure)
    ;;
    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac
exit 0
 |