[Pkg-nagios-changes] [SCM] Debian packaging for lconf branch, master, updated. 55c830d5bfe0d8efe96193f2b447fb06da82ac93

Birger Schmidt birger.schmidt at netways.de
Mon Jun 20 10:11:55 UTC 2011


The following commit has been merged in the master branch:
commit 598f4448ea6d44dac429a3e676c22bc6520d5974
Author: Birger Schmidt <birger.schmidt at netways.de>
Date:   Thu Apr 14 11:19:24 2011 +0200

    * lconf_deploy.sh: use vars to make it configurable, fix a rsync/sudo issue

diff --git a/source/lconf_deploy.sh b/source/lconf_deploy.sh
index f579daf..32ba6cc 100644
--- a/source/lconf_deploy.sh
+++ b/source/lconf_deploy.sh
@@ -10,11 +10,23 @@ LCONFDIR="/etc/icinga/lconf"
 LCONFTMP="/etc/icinga/lconf.tmp"
 ICINGACONFIG=/etc/icinga/icinga.cfg
 ICINGATMPCONFIG=/etc/icinga/icinga.tmp.cfg
+ICINGAUSER=icinga
+ICINGAGROUP=icinga
+ICINGABIN=$(which icinga)
+
+
+if [ ! -x $ICINGABIN ] ; then
+  ICINGABIN=/usr/local/icinga/bin/icinga
+  if [ ! -x $ICINGABIN ] ; then
+    echo "ERROR: Could not find icinga binary to check the config!"
+    exit 2
+  fi
+fi
 
 RUNUSER=$(whoami)
 SUDOCOMMAND=""
-if [ "$RUNUSER" != "icinga" ] ; then
-  SUDOCOMMAND="sudo -u icinga"
+if [ "$RUNUSER" != $ICINGAUSER ] ; then
+  SUDOCOMMAND="sudo -u $ICINGAUSER"
 fi
 
 
@@ -22,12 +34,12 @@ fi
 # main
 #################################################
 
-install -d -o icinga -g icinga $LCONFDIR
-install -d -o icinga -g icinga $LCONFTMP
+install -d -o $ICINGAUSER -g $ICINGAGROUP $LCONFDIR
+install -d -o $ICINGAUSER -g $ICINGAGROUP $LCONFTMP
 
 
 # alter the icinga.cfg to check against the tmp dir
-install -o icinga -g icinga -m 640 $ICINGACONFIG $ICINGATMPCONFIG
+install -o $ICINGAUSER -g $ICINGAGROUP -m 640 $ICINGACONFIG $ICINGATMPCONFIG
 sed 's/^\(cfg_.*\)/#lconftest#\1/' $ICINGACONFIG > $ICINGATMPCONFIG
 echo cfg_dir=$LCONFTMP >> $ICINGATMPCONFIG
 
@@ -38,10 +50,7 @@ echo export config from LDAP
  
  
 # first test the config within the tmp dir
-if ( icinga -v $ICINGATMPCONFIG ) then
- 
-  # copy the preliminary config in place to pass the check
-  $SUDOCOMMAND rsync -a --del "$LCONFTMP"/* "$LCONFDIR"
+if ( $ICINGABIN -v $ICINGATMPCONFIG ) then
  
   # generate config for satellites
   # this process may alter the original config
@@ -56,7 +65,7 @@ if ( icinga -v $ICINGATMPCONFIG ) then
   done
 
   # copy the final config in place
-  $SUDOCOMMAND rsync -a --del "$LCONFTMP"/* "$LCONFDIR"
+  $SUDOCOMMAND -i rsync -a --del "$LCONFTMP"/ "$LCONFDIR"
 
   # reload the final config on the master
   echo reload config on Master $(hostname -f)

-- 
Debian packaging for lconf



More information about the Pkg-nagios-changes mailing list