]> granicus.if.org Git - icinga2/commitdiff
Debian: Made handling of features-enabled respecting disabled features.
authorMarkus Frosch <markus@lazyfrosch.de>
Wed, 4 Dec 2013 18:06:43 +0000 (19:06 +0100)
committerMarkus Frosch <markus@lazyfrosch.de>
Wed, 4 Dec 2013 18:06:43 +0000 (19:06 +0100)
The default features now only get enabled on fresh installs. This has been
changed for icinga2-common and icinga2-classicui.

Fixes #5102

debian/icinga2-classicui.postinst
debian/icinga2-common.postinst
debian/icinga2-common.postrm
debian/rules

index 917dc3a02fdd874a536c094accb5bc75f3b520e0..d50780c6644dd6b9e7a0724616a882d29e2c99c0 100644 (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)
index b33c9d1e9e31f5371524b4dbcf50be0e22f07702..32d2f9e5821875b8bee2f4cb080056c317c2e93f 100644 (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)
index f6d0e94b98c4714c36db81227df39fc8f01f5387..473635daa73b5181dd1a277fbb80865e0a691271 100644 (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/
index 01c631e024185308ea5a9557880ab83909e0cfd3..7740fbe885783947f271705edd4e5a81c3f4e748 100755 (executable)
@@ -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