diff options
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/sitesummary.postinst | 48 |
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 |