summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9519bf0)
raw | patch | inline | side by side (parent: 9519bf0)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 10 Feb 2011 12:03:39 +0000 (13:03 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 10 Feb 2011 12:03:39 +0000 (13:03 +0100) |
Also, use po-debconf for internationalization support.
debian/changelog | patch | blob | history | |
debian/control | patch | blob | history | |
debian/pnp4nagios-web.config | [new file with mode: 0644] | patch | blob |
debian/pnp4nagios-web.postinst | patch | blob | history | |
debian/pnp4nagios-web.templates | [new file with mode: 0644] | patch | blob |
debian/po/POTFILES.in | [new file with mode: 0644] | patch | blob |
debian/po/templates.pot | [new file with mode: 0644] | patch | blob |
debian/rules | patch | blob | history |
diff --git a/debian/changelog b/debian/changelog
index 4f0f54f592bce53e0ea759de3e6094a0091aec39..a7ca00dc49995ffba2c0d7d04e13e304b638e5f0 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
- pnp4nagios-web: web interface
- pnp4nagios: metapackage depending on the other two
* debian/watch: mange upstream version to replace ".rc" with "~rc".
+ * Make Apache2 configuration optional using debconf.
- -- Sebastian Harl <tokkee@debian.org> Wed, 09 Feb 2011 17:22:47 +0100
+ -- Sebastian Harl <tokkee@debian.org> Thu, 10 Feb 2011 13:03:06 +0100
diff --git a/debian/control b/debian/control
index 2967297e64e8d0c01f954a94f227c6edcf184c01..fb277f639abb23ce34a041fa79f4c57c32014bd6 100644 (file)
--- a/debian/control
+++ b/debian/control
Priority: optional
Maintainer: Sven Velt <sven@velt.de>
Uploaders: Sebastian Harl <tokkee@debian.org>
-Build-Depends: autotools-dev, debhelper (>= 7), rrdtool, librrds-perl, quilt
+Build-Depends: autotools-dev, debhelper (>= 7), po-debconf, quilt,
+ rrdtool, librrds-perl
Standards-Version: 3.9.1
Homepage: http://www.pnp4nagios.org/
diff --git a/debian/pnp4nagios-web.config b/debian/pnp4nagios-web.config
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# config script for pnp4nagios-web
+#
+# see: dh_installdebconf(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <preconfigure> `configure' <installed-version>
+# * <postinst> `configure' <old-version>
+# * <reconfigure> `reconfigure' <installed-version>
+
+. /usr/share/debconf/confmodule
+
+case "$1" in
+ configure|reconfigure)
+ default_servers=""
+ if test -d /etc/apache2/conf.d; then
+ default_servers="apache2"
+ fi
+
+ db_fget pnp4nagios-web/httpd seen
+ if [ "$RET" = "false" ]; then
+ db_set pnp4nagios-web/httpd "$default_servers"
+ fi
+
+ db_input medium pnp4nagios-web/httpd || true
+ db_go || true
+ ;;
+
+ *)
+ echo "config called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+db_stop
+
+exit 0
+
index d2fd8aa52cb28a9941b90bb500b96c6a41dec74b..9e35d766d6da6bd5add850cff3656ba2bafc3950 100644 (file)
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
+. /usr/share/debconf/confmodule
+
setperm() {
user="$1"
group="$2"
fi
}
+configure_apache2() {
+ a2reload="false"
+
+ if [ -d /etc/apache2/conf.d/ ]; then
+ if [ ! -e /etc/apache2/conf.d/pnp4nagios.conf ]; then
+ ln -s /etc/pnp4nagios/apache.conf /etc/apache2/conf.d/pnp4nagios.conf
+ a2reload="true"
+ fi
+ fi
+
+ if [ -d /etc/apache2/mods-enabled ]; then
+ if [ ! -e /etc/apache2/mods-enabled/rewrite.load ]; then
+ a2enmod rewrite
+ a2reload="true"
+ fi
+ fi
+
+ if [ "$a2reload" = "true" ]; then
+ invoke-rc.d apache2 reload
+ fi
+}
+
case "$1" in
configure)
if ! getent passwd nagios > /dev/null ; then
setperm nagios www-data 750 /var/log/pnp4nagios
setperm nagios nagios 750 /var/log/pnp4nagios/stats
- a2reload="false"
-
- if [ -d /etc/apache2/conf.d/ ]; then
- if [ ! -e /etc/apache2/conf.d/pnp4nagios.conf ]; then
- ln -s /etc/pnp4nagios/apache.conf /etc/apache2/conf.d/pnp4nagios.conf
- a2reload="true"
- fi
- fi
-
- if [ -d /etc/apache2/mods-enabled ]; then
- if [ ! -e /etc/apache2/mods-enabled/rewrite.load ]; then
- a2enmod rewrite
- a2reload="true"
- fi
- fi
+ db_get pnp4nagios-web/httpd
+ http_servers=`echo $RET | sed -e 's/,/ /g'`
- if [ "$a2reload" = "true" ]; then
- invoke-rc.d apache2 reload
- fi
+ for httpd in $http_servers; do
+ case "$httpd" in
+ apache2)
+ configure_apache2
+ ;;
+ # WISHLIST: configure other web servers as well
+ *)
+ echo "Don't know how to configure web server $httpd" >&2
+ ;;
+ esac
+ done
;;
abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/pnp4nagios-web.templates b/debian/pnp4nagios-web.templates
--- /dev/null
@@ -0,0 +1,9 @@
+Template: pnp4nagios-web/httpd
+Type: multiselect
+Choices: apache2
+Default: apache2
+_Description: Web servers to configure for PNP4Nagios:
+ Please select which web servers should be configured for PNP4Nagios.
+ .
+ If you would prefer to perform configuration manually, leave all
+ servers unselected.
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] pnp4nagios-web.templates
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,38 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: pnp4nagios@packages.debian.org\n"
+"POT-Creation-Date: 2011-02-10 12:58+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: multiselect
+#. Description
+#: ../pnp4nagios-web.templates:1001
+msgid "Web servers to configure for PNP4Nagios:"
+msgstr ""
+
+#. Type: multiselect
+#. Description
+#: ../pnp4nagios-web.templates:1001
+msgid "Please select which web servers should be configured for PNP4Nagios."
+msgstr ""
+
+#. Type: multiselect
+#. Description
+#: ../pnp4nagios-web.templates:1001
+msgid ""
+"If you would prefer to perform configuration manually, leave all servers "
+"unselected."
+msgstr ""
diff --git a/debian/rules b/debian/rules
index 7675dad0c995a8a748a803e8c9f73b5b77733d69..3eb49de02acd84e5767a29f369a33f0c3c29f4d0 100755 (executable)
--- a/debian/rules
+++ b/debian/rules
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean
+ debconf-updatepo
install: build
dh_testdir
dh_installchangelogs -i ChangeLog
dh_installdocs -A -i AUTHORS README debian/README.Debian
dh_installexamples -i
+ dh_installdebconf -i
dh_installinit -i
dh_installman -i
dh_link -i
dh_installchangelogs -a ChangeLog
dh_installdocs -A -a AUTHORS README debian/README.Debian
dh_installexamples -a
+ dh_installdebconf -a
dh_installinit -ppnp4nagios-bin --name=npcd
dh_installinit -a -Npnp4nagios-bin
dh_installman -a man/npcd.8