aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2010-01-26 22:15:33 +0000
committerPetter Reinholdtsen <pere@hungry.com>2010-01-26 22:15:33 +0000
commitbe7419d972d8ba82e95f35d35e547b67468bc704 (patch)
tree8b07924d970ab937a5ff3a567796cbc15a7a3298
parent7b8697829a464cf9fad7fbda9c7f73f57995a890 (diff)
downloadsitesummary-be7419d972d8ba82e95f35d35e547b67468bc704.tar.gz
sitesummary-be7419d972d8ba82e95f35d35e547b67468bc704.tar.bz2
sitesummary-be7419d972d8ba82e95f35d35e547b67468bc704.tar.xz
Adjust sitesummary postinst to only try to enable nagios
autoconfig if /etc/default/nagios3 exist.
-rw-r--r--debian/changelog2
-rw-r--r--debian/sitesummary.postinst48
2 files changed, 29 insertions, 21 deletions
diff --git a/debian/changelog b/debian/changelog
index 82eb561..701cffb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ sitesummary (0.0.59) UNRELEASED; urgency=low
Petter Reinholdtsen.
* Introduce new agesinceseen group 120-180 to have one limit that
match the removal limit (120 days).
+ * Adjust sitesummary postinst to only try to enable nagios
+ autoconfig if /etc/default/nagios3 exist.
-- Petter Reinholdtsen <pere@debian.org> Tue, 26 Jan 2010 08:56:53 +0100
diff --git a/debian/sitesummary.postinst b/debian/sitesummary.postinst
index d828ab7..6362027 100644
--- a/debian/sitesummary.postinst
+++ b/debian/sitesummary.postinst
@@ -5,6 +5,31 @@ set -e
# Source debconf library.
. /usr/share/debconf/confmodule
+test_nagios() {
+ if grep -q '^NAGIOSCFG="/etc/nagios3/sitesummary.cfg"$' "$config"; then
+ :
+ else
+ db_get sitesummary/enable-nagios-config
+ if [ true = "$RET" ] ; then
+ mkdir -p $(dirname $config)
+ echo 'NAGIOSCFG="/etc/nagios3/sitesummary.cfg"' \
+ >> /etc/default/nagios3
+ if [ ! -f /var/lib/sitesummary/nagios-generated.cfg ] ; then
+ # Create dummy file to make sure nagios will start
+ # on first boot if sitesummary is installed using
+ # debian-installer
+ cat > /var/lib/sitesummary/nagios-generated.cfg <<EOF
+define host {
+ use server-host
+ host_name localhost
+ address localhost
+}
+EOF
+ fi
+ fi
+ fi
+}
+
case "$1" in
configure)
@@ -34,27 +59,8 @@ case "$1" in
fi
config=/etc/default/nagios3
- if grep -q '^NAGIOSCFG="/etc/nagios3/sitesummary.cfg"$' "$config"; then
- :
- else
- db_get sitesummary/enable-nagios-config
- if [ true = "$RET" ] ; then
- mkdir -p $(dirname $config)
- echo 'NAGIOSCFG="/etc/nagios3/sitesummary.cfg"' \
- >> /etc/default/nagios3
- if [ ! -f /var/lib/sitesummary/nagios-generated.cfg ] ; then
- # Create dummy file to make sure nagios will start
- # on first boot if sitesummary is installed using
- # debian-installer
- cat > /var/lib/sitesummary/nagios-generated.cfg <<EOF
-define host {
- use server-host
- host_name localhost
- address localhost
-}
-EOF
- fi
- fi
+ if [ -f "$config" ] ; then
+ test_nagios
fi
# Generate the web page at install time