[Pkg-nagios-changes] [pkg-check-mk] 08/09: Handle apache 2.2 and apache2.4
Alexander Wirt
formorer at debian.org
Sun Sep 8 10:03:27 UTC 2013
This is an automated email from the git hooks/post-receive script.
formorer pushed a commit to branch master
in repository pkg-check-mk.
commit fd007c210a8bf478b8a16e9448985a07117bd06d
Author: Thomas Bechtold <t.bechtold at telekom.de>
Date: Fri Aug 9 11:58:15 2013 +0200
Handle apache 2.2 and apache2.4
---
debian/apache.icinga | 10 ++++++++--
debian/apache.nagios3 | 10 ++++++++--
debian/check-mk-config-icinga.postinst | 12 ++++++++++++
debian/check-mk-config-icinga.postrm | 12 ++++++++++++
debian/check-mk-config-nagios3.postinst | 11 +++++++++++
debian/check-mk-config-nagios3.postrm | 12 ++++++++++++
debian/rules | 8 ++++----
7 files changed, 67 insertions(+), 8 deletions(-)
diff --git a/debian/apache.icinga b/debian/apache.icinga
index c41d687..459b898 100644
--- a/debian/apache.icinga
+++ b/debian/apache.icinga
@@ -17,11 +17,17 @@
PythonDebug On
DirectoryIndex index.py
+ #Handle apache 2.2 and 2.4
+ <IfVersion >= 2.3>
+ Require local
+ </IfVersion>
+ <IfVersion < 2.3>
+ Order deny,allow
+ allow from all
+ </IfVersion>
# Need Nagios authentification. Please edit the
# following: Set AuthName and AuthUserFile to the
# same value that you use for your Nagios configuration!
- Order deny,allow
- allow from all
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga/htpasswd.users
diff --git a/debian/apache.nagios3 b/debian/apache.nagios3
index 1ee7f69..a3b4603 100644
--- a/debian/apache.nagios3
+++ b/debian/apache.nagios3
@@ -17,11 +17,17 @@
PythonDebug On
DirectoryIndex index.py
+ #Handle apache 2.2 and 2.4
+ <IfVersion >= 2.3>
+ Require local
+ </IfVersion>
+ <IfVersion < 2.3>
+ Order deny,allow
+ allow from all
+ </IfVersion>
# Need Nagios authentification. Please edit the
# following: Set AuthName and AuthUserFile to the
# same value that you use for your Nagios configuration!
- Order deny,allow
- allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios3/htpasswd.users
diff --git a/debian/check-mk-config-icinga.postinst b/debian/check-mk-config-icinga.postinst
index bc39120..459742c 100644
--- a/debian/check-mk-config-icinga.postinst
+++ b/debian/check-mk-config-icinga.postinst
@@ -39,6 +39,18 @@ case "$1" in
#fix permissions for some directorys
test -d /etc/icinga/objects/check_mk || mkdir -p /etc/icinga/objects/check_mk
setperm root nagios 0775 /etc/icinga/objects/check_mk
+
+ #handle the apache2.2 -> apache2.4 upgrade (see https://wiki.debian.org/Apache/PackagingFor24)
+ CONF="check-mk-multisite"
+ COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
+
+ if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+ . /usr/share/apache2/apache2-maintscript-helper
+ apache2_invoke enconf $CONF || exit $?
+ elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
+ [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/$CONF.conf ] && ln -s ../conf-available/$CONF.conf /etc/apache2/conf.d/$CONF.conf
+ fi
+
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
diff --git a/debian/check-mk-config-icinga.postrm b/debian/check-mk-config-icinga.postrm
index 8f9d02e..071d8bf 100644
--- a/debian/check-mk-config-icinga.postrm
+++ b/debian/check-mk-config-icinga.postrm
@@ -7,5 +7,17 @@ dpkg-maintscript-helper mv_conffile \
/etc/icinga/objects/check_mk/check_mk_templates.cfg \
1.1.10-2 -- "$@"
+if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
+ CONF="check-mk-multisite"
+ COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
+
+ if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+ . /usr/share/apache2/apache2-maintscript-helper
+ apache2_invoke disconf $CONF || exit $?
+ elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
+ [ -L /etc/apache2/conf.d/$CONF.conf ] && rm /etc/apache2/conf.d/$CONF.conf || true
+ fi
+fi
+
#DEBHELPER#
diff --git a/debian/check-mk-config-nagios3.postinst b/debian/check-mk-config-nagios3.postinst
index f5b0bf6..5bc6769 100644
--- a/debian/check-mk-config-nagios3.postinst
+++ b/debian/check-mk-config-nagios3.postinst
@@ -39,6 +39,17 @@ case "$1" in
#fix permissions for some directorys
test -d /etc/nagios3/conf.d/check_mk || mkdir -p /etc/nagios3/conf.d/check_mk
setperm root nagios 0775 /etc/nagios3/conf.d/check_mk
+
+ #handle the apache2.2 -> apache2.4 upgrade (see https://wiki.debian.org/Apache/PackagingFor24)
+ CONF="check-mk-multisite"
+ COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
+
+ if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+ . /usr/share/apache2/apache2-maintscript-helper
+ apache2_invoke enconf $CONF || exit $?
+ elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
+ [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/$CONF.conf ] && ln -s ../conf-available/$CONF.conf /etc/apache2/conf.d/$CONF.conf
+ fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
diff --git a/debian/check-mk-config-nagios3.postrm b/debian/check-mk-config-nagios3.postrm
index cdb5b1e..92883b3 100644
--- a/debian/check-mk-config-nagios3.postrm
+++ b/debian/check-mk-config-nagios3.postrm
@@ -7,4 +7,16 @@ dpkg-maintscript-helper mv_conffile \
/etc/nagios3/conf.d/check_mk/check_mk_templates.cfg \
1.1.10-2 -- "$@"
+if [ "$1" = "remove" ] || [ "$1" = "purge" ] ; then
+ CONF="check-mk-multisite"
+ COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
+
+ if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
+ . /usr/share/apache2/apache2-maintscript-helper
+ apache2_invoke disconf $CONF || exit $?
+ elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
+ [ -L /etc/apache2/conf.d/$CONF.conf ] && rm /etc/apache2/conf.d/$CONF.conf || true
+ fi
+fi
+
#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index c6f4e58..159674e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -71,10 +71,10 @@ install: build
mkdir -p debian/check-mk-config-nagios3/usr/share/check_mk/modules/
cp debian/defaults.nagios3 debian/check-mk-config-nagios3/usr/share/check_mk/modules/defaults
# We need 2 different Apache configs
- mkdir -p debian/check-mk-config-icinga/etc/apache2/conf.d/
- cp debian/apache.icinga debian/check-mk-config-icinga/etc/apache2/conf.d/check-mk-multisite.conf
- mkdir -p debian/check-mk-config-nagios3/etc/apache2/conf.d/
- cp debian/apache.nagios3 debian/check-mk-config-nagios3/etc/apache2/conf.d/check-mk-multisite.conf
+ mkdir -p debian/check-mk-config-icinga/etc/apache2/conf-available/
+ cp debian/apache.icinga debian/check-mk-config-icinga/etc/apache2/conf-available/check-mk-multisite.conf
+ mkdir -p debian/check-mk-config-nagios3/etc/apache2/conf-available/
+ cp debian/apache.nagios3 debian/check-mk-config-nagios3/etc/apache2/conf-available/check-mk-multisite.conf
# Adjust path names
# sed -i 's#/nagios/cgi-bin/#/cgi-bin/icinga/#' debian/tmp/check-mk-config-icinga/etc/icinga/objects/check_mk_templates.cfg
# sed -i 's#/nagios/cgi-bin/#/cgi-bin/nagios3/#' debian/tmp/check-mk-config-nagios3/etc/nagios3/conf.d/check_mk_templates.cfg
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-check-mk.git
More information about the Pkg-nagios-changes
mailing list