[Pkg-nagios-changes] [SCM] debian packaging of icinga(-core) branch, master, updated. debian/1.9.1-2-11-gdb397b3

Alexander Wirt formorer at debian.org
Fri Jul 12 06:00:56 UTC 2013


The following commit has been merged in the master branch:
commit f9969c2133ad1babdd1130037746ea07f5901392
Author: Alexander Wirt <formorer at debian.org>
Date:   Thu Jul 11 22:25:22 2013 +0200

    Add support for apache2.4

diff --git a/debian/icinga-cgi.config b/debian/icinga-cgi.config
index 587dab4..58ba63d 100644
--- a/debian/icinga-cgi.config
+++ b/debian/icinga-cgi.config
@@ -2,50 +2,19 @@
 
 . /usr/share/debconf/confmodule
 
-# (taken from the webapps-common httpd functions)
-# wc_httpd_installed: test for installed httpds
-# usage:
-#       wc_httpd_installed [ httpd1 httpd2 ... ]
-#
-# no arguments implies to test for all servers
-wc_httpd_installed(){
-        local httpds
-        if [ "$*" ]; then
-                httpds=$*
-        else
-                httpds=$wc_httpd_supported
-        fi
-        for f in $httpds; do
-                if test -x /usr/sbin/$f; then
-                        echo $f
-                fi
-        done
-}
+db_fget icinga/adminpassword seen || true
+password_seen="$RET"
 
-
-# list of installed servers to check for
-default_servers=`wc_httpd_installed apache2`
-# convert list to comma seperated list
-server_list=`echo $default_servers | sed -e 's/[[:space:]][[:space:]]*/, /g'`
-
-# if they haven't already been prompted, preseed the server selection
-db_fget icinga/httpd seen
-if [ "$RET" = "false" ]; then
-	db_set icinga/httpd $server_list
+if [ "$1" = "reconfigure" ]; then
+    password_seen=false
 fi
 
-db_input high icinga/httpd || true
-db_go || true
-db_get icinga/httpd
-keepgoing="$RET"
-
-if [ "$keepgoing" ]; then
+if [ "$password_seen" != "true" ]; then
 	# the passwords are reset at the end of every postinst run,
 	# however, they are left in the "seen" state so that the
 	# admin is not prompted for them at every upgrade.
 	while [ ! "$passwordsmatch" ]; do
 		#only ask for a password if no htpasswd exists
-		test -f /etc/icinga/htpasswd.users && break 
 		db_input high icinga/adminpassword || true
 		db_input high icinga/adminpassword-repeat || true
 		db_go || true
diff --git a/debian/icinga-cgi.install b/debian/icinga-cgi.install
index 2579bd7..bf0201c 100644
--- a/debian/icinga-cgi.install
+++ b/debian/icinga-cgi.install
@@ -1,5 +1,4 @@
 debian-configs/cgi.cfg /etc/icinga
-debian/httpd.webapps-common /usr/share/icinga/debian
 usr/lib/cgi-bin/*
 usr/share/icinga/htdocs/*.html
 usr/share/icinga/htdocs/jquery-ui-addon
diff --git a/debian/icinga-cgi.links b/debian/icinga-cgi.links
index d443456..d329730 100644
--- a/debian/icinga-cgi.links
+++ b/debian/icinga-cgi.links
@@ -1,3 +1,4 @@
 usr/share/javascript/jquery/jquery.min.js usr/share/icinga/htdocs/js/jquery-1.8.0.min.js
 usr/share/javascript/jquery-ui usr/share/icinga/htdocs/jquery-ui
 etc/icinga/stylesheets usr/share/icinga/stylesheets
+etc/icinga/apache2.conf etc/apache2/conf-available/icinga.conf
diff --git a/debian/icinga-cgi.postinst b/debian/icinga-cgi.postinst
index dc15b1e..9e5db37 100644
--- a/debian/icinga-cgi.postinst
+++ b/debian/icinga-cgi.postinst
@@ -8,8 +8,6 @@ enc="/etc/icinga/objects/"
 usn="/usr/share/icinga"
 
 . /usr/share/debconf/confmodule
-. $usn/debian/httpd.webapps-common
-
 if [ -n "$ICINGADEBUG" ]; then
   echo "now debugging $0 $@"
   set -x
@@ -41,50 +39,32 @@ case "$1" in
               --disabled-login --force-badname nagios > /dev/null
     fi
 
-	# get the list of selected servers
-	db_get icinga/httpd
-	servers=$(echo $RET | sed -e 's/,/ /g')
 	db_get icinga/adminpassword
 	admpass="$RET"
 
-	unwanted_servers=""
-
-	#check which servers to uninclude
-	for s in $wc_httpd_supported
-	do
-		if ! echo $servers | grep -q $s
-		then
-			unwanted_servers="$s $unwanted_servers"
-		fi
-	done
-
-
-	ucf --debconf-ok /usr/share/icinga/apache2.conf $apacheconf
-
-	# configure the web servers, if it is desired
-	if [ "$servers" ]; then
-		if wc_httpd_apache_include $apacheconf icinga $servers; then
-			# reload the selected servers if they are running 
-			running_servers="$(wc_httpd_running $servers)"
-			if [ "$running_servers" ]; then
-				wc_httpd_invoke "reload" $running_servers
-			fi
-		fi	
-	fi
+    # register apache2.conf via ucf:
+    ucf --debconf-ok /usr/share/icinga/apache2.conf $apacheconf
 
-	if [ "$unwanted_servers" ]; then
-		servers_to_deconf="$(wc_httpd_apache_configured $apacheconf icinga $unwanted_servers)"
-		if [ "$servers_to_deconf" ]; then
-			if wc_httpd_apache_uninclude $apacheconf icinga $servers_to_deconf; then
-				# reload the selected servers if they are running
-				running_servers="$(wc_httpd_running $unwanted_servers)"
-				if [ "$running_servers" ]; then
-					wc_httpd_invoke "reload" $running_servers
-				fi
-			fi
-		fi
-	fi
+    COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
+
+    # NEW method for Apache >= 2.4
+    if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
+        . /usr/share/apache2/apache2-maintscript-helper
+
+        apache2_invoke enconf icinga
+
+        # remove OLD Apache 2.2 link
+        [ -L /etc/apache2/conf.d/icinga.conf ] && rm /etc/apache2/conf.d/icinga.conf
+
+        # OLD methods for Apache < 2.4
+    elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
+
+        # create symlink if not existing
+        [ -f /etc/apache2/conf.d/icinga.conf ] || ln -vs $apacheconf /etc/apache2/conf.d/icinga.conf
 
+        # reload webserver
+        [ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload
+    fi  
 
 	# we reset the password every run, so if it exists we're running
 	# after being specifically given a password and can unconditionally set it.
diff --git a/debian/icinga-cgi.postrm b/debian/icinga-cgi.postrm
index 8ad9d6a..1e34436 100644
--- a/debian/icinga-cgi.postrm
+++ b/debian/icinga-cgi.postrm
@@ -5,6 +5,20 @@ en="/etc/icinga"
 enc="/etc/icinga/objects"
 usn="/usr/share/icinga"
 
+# Apache2
+if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+    echo "disabling Apache2 configuration ..."
+    . /usr/share/apache2/apache2-maintscript-helper
+    apache2_invoke disconf icinga
+fi
+if [ -L /etc/apache2/conf.d/icinga.conf ]; then
+    echo "removing link /etc/apache2/conf.d/icinga.conf ..."
+    # remove link to config
+    rm -f /etc/apache2/conf.d/icinga
+    # reload webserver
+    [ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload || true
+fi
+
 case "$1" in
   remove)
   	;;

-- 
debian packaging of icinga(-core)



More information about the Pkg-nagios-changes mailing list