diff options
Diffstat (limited to 'debian/sitesummary.postinst')
-rw-r--r-- | debian/sitesummary.postinst | 48 |
1 files changed, 27 insertions, 21 deletions
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 |