fi
}
+is_fresh_install()
+{
+ if [ -z "$2" ] ; then
+ return 0
+ fi
+ return 1
+}
+
+enable_features_for_classic() {
+ if is_fresh_install $@; then
+ echo "enabling icinga2 features for classicui"
+
+ for feature in compatlog statusdata command; do
+ icinga2-enable-feature $feature
+ done
+
+ echo "reloading icinga2"
+ [ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
+ fi
+ # handle new default features here in the future
+}
case "$1" in
configure)
- if [ -x "`which icinga2-enable-feature`" ]; then
- echo "enabling icinga2 feature compatlog, statusdata and command"
- icinga2-enable-feature compatlog
- icinga2-enable-feature statusdata
- icinga2-enable-feature command
-
- echo "reloading icinga2"
- [ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
- fi
+ enable_features_for_classic $@
echo "enabling Apache2 config..."
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
fi
}
+is_fresh_install()
+{
+ if [ -z "$2" ] ; then
+ return 0
+ fi
+ return 1
+}
+
+enable_default_features() {
+ if is_fresh_install $@; then
+ echo "enabling default icinga2 features"
+ for feature in checker notification mainlog; do
+ icinga2-enable-feature $feature
+ done
+ fi
+ # handle new default features here in the future
+}
+
case "$1" in
configure)
if ! getent passwd nagios > /dev/null ; then
setperm nagios www-data 0750 /var/cache/icinga2
setperm nagios nagios 0750 /var/spool/icinga2
+ # enable default features
+ enable_default_features $@
;;
abort-upgrade|abort-remove|abort-deconfigure)
case "$1" in
purge)
- rm -f /etc/icinga2/features-enabled/*
+ for f in /etc/icinga2/features-enabled/*; do
+ [ -L "$f" ] && rm -f "$f"
+ done
rm -rf /var/lib/icinga2/
rm -rf /var/log/icinga2/
rm -rf /var/cache/icinga2/
-DICINGA2_COMMAND_USER=nagios \
-DICINGA2_COMMAND_GROUP=www-data
+override_dh_auto_install:
+ dh_auto_install
+ # remove features-enabled - these will be activated by postinst later
+ rm -r debian/tmp/etc/icinga2/features-enabled/*
+
override_dh_install:
dh_install
# remove ido files from other packages