2 # postinst script for icinga2-common
12 # only do something when no setting exists
13 if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
14 chown "$user":"$group" "$file"
27 enable_default_features() {
28 FIX_VERSION="0.0.5+icingasnap201312070000"
29 if is_fresh_install $@ \
30 || dpkg --compare-versions "$2" lt "$FIX_VERSION"; then
31 echo "enabling default icinga2 features"
32 for feature in checker notification mainlog; do
33 icinga2-enable-feature $feature
36 # handle new default features here in the future
41 if ! getent passwd nagios > /dev/null ; then
42 echo 'Adding system-user for nagios' 1>&2
43 adduser --system --group --home /var/lib/nagios \
44 --disabled-login --force-badname nagios > /dev/null
47 # explicitly set permissions on some files that are dependent
48 # on the uid/gid of the nagios user, which is dynamically created.
49 setperm nagios adm 2751 /var/log/icinga2
50 setperm nagios adm 2751 /var/log/icinga2/compat
51 setperm nagios adm 2755 /var/log/icinga2/compat/archives
53 setperm nagios nagios 0750 /var/lib/icinga2
54 setperm nagios nagios 0750 /var/lib/icinga2/api
55 setperm nagios nagios 0750 /var/lib/icinga2/api/log
56 setperm nagios nagios 0750 /var/lib/icinga2/api/repository
58 setperm nagios www-data 0750 /var/cache/icinga2
60 setperm nagios nagios 0750 /var/spool/icinga2
61 setperm nagios nagios 0750 /var/spool/icinga2/perfdata
62 setperm nagios nagios 0750 /var/spool/icinga2/tmp
64 # enable default features
65 enable_default_features $@
68 abort-upgrade|abort-remove|abort-deconfigure)
72 echo "postinst called with unknown argument \`$1'" >&2
79 echo "Icinga 2 was unable to start due to configuration errors.";
80 echo "Please fix them and manually restart the icinga2 daemon using";
81 echo " ´service icinga2 start´";