Debian: Made handling of features-enabled respecting disabled features.

The default features now only get enabled on fresh installs. This has been
changed for icinga2-common and icinga2-classicui.

Fixes #5102
This commit is contained in:
Markus Frosch 2013-12-04 19:06:43 +01:00
parent 2553287818
commit 1399ac6047
4 changed files with 50 additions and 10 deletions

View File

@ -26,18 +26,31 @@ setperm() {
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)

View File

@ -16,6 +16,24 @@ setperm() {
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
@ -38,6 +56,8 @@ case "$1" in
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)

View File

@ -5,7 +5,9 @@ set -e
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/

5
debian/rules vendored
View File

@ -22,6 +22,11 @@ override_dh_auto_configure:
-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