From 2020d3a4bfb3a99ffe8364b06cfd22539861516e Mon Sep 17 00:00:00 2001 From: slerena Date: Tue, 18 May 2010 16:09:06 +0000 Subject: [PATCH] 2010-05-18 Sancho Lerena * unix/pandora_agent_installer: New version of installer. Now allow to install the agent and all its dependencies, configuration and logfiles inside a specific directory, for example: /opt/pandora. That directory will contain all data, even the logs. Default configuration file and launcher daemon script are modified in realtime to have that custom defined directory. Removed "with-links" method. * *.conf: Minor modification to use the new method of install in a custom directory. * unix/pandora_agent_daemon: Build update and some small modifications to use the custom directory. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2748 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/ChangeLog | 15 + pandora_agents/unix/AIX/pandora_agent.conf | 4 +- pandora_agents/unix/HP-UX/pandora_agent.conf | 4 +- pandora_agents/unix/Linux/pandora_agent.conf | 4 +- pandora_agents/unix/SunOS/pandora_agent.conf | 4 +- pandora_agents/unix/pandora_agent_daemon | 10 +- pandora_agents/unix/pandora_agent_installer | 300 +++++++++++-------- 7 files changed, 202 insertions(+), 139 deletions(-) diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index 558aba935a..1de93c35b5 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,18 @@ +2010-05-18 Sancho Lerena + + * unix/pandora_agent_installer: New version of installer. Now allow + to install the agent and all its dependencies, configuration and logfiles + inside a specific directory, for example: /opt/pandora. That directory + will contain all data, even the logs. Default configuration file and + launcher daemon script are modified in realtime to have that custom + defined directory. Removed "with-links" method. + + * *.conf: Minor modification to use the new method of install in a custom + directory. + + * unix/pandora_agent_daemon: Build update and some small modifications + to use the custom directory. + 2010-05-17 Sergio Martin * linux/pandora_agent.conf: Improved the default diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index 705a863ee2..b9d617faad 100755 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -9,8 +9,8 @@ server_ip localhost server_path /var/spool/pandora/data_in -temporal /tmp -logfile /var/log/pandora/pandora_agent.log +temporal /tmp +logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index 277bc3aa58..bb76f3abc6 100755 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -9,8 +9,8 @@ server_ip localhost server_path /var/spool/pandora/data_in -temporal /tmp -logfile /var/log/pandora/pandora_agent.log +temporal /tmp +logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index 6c0545ec90..02fbb6329c 100755 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -9,8 +9,8 @@ server_ip localhost server_path /var/spool/pandora/data_in -temporal /tmp -logfile /var/log/pandora/pandora_agent.log +temporal /tmp +logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index ceb623d325..0b5e85f9d9 100755 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -9,8 +9,8 @@ server_ip localhost server_path /var/spool/pandora/data_in -temporal /tmp -logfile /var/log/pandora/pandora_agent.log +temporal /tmp +logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default interval 300 diff --git a/pandora_agents/unix/pandora_agent_daemon b/pandora_agents/unix/pandora_agent_daemon index a134658acc..00a91c3637 100755 --- a/pandora_agents/unix/pandora_agent_daemon +++ b/pandora_agents/unix/pandora_agent_daemon @@ -2,11 +2,11 @@ # ********************************************************************** # Pandora FMS Agent Daemon launcher for Unix (AIX, HP-UX, SunOS, Linux) -# (c) 2008-2009 Artica ST -# (c) 2008-2009 Sancho Lerena +# (c) 2008-2010 Artica ST +# (c) 2008-2010 Sancho Lerena # # Please see http://www.pandorafms.org -# v3.0 Build 091103 +# v3.1 Build 100515 # This code is licensed under GPL 2.0 license. # ********************************************************************** @@ -23,12 +23,12 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin PANDORA_PATH=/etc/pandora DAEMON=/usr/bin/pandora_agent -LOGFILE=/var/log/pandora_agent.log +LOGFILE=/var/log/pandora/pandora_agent.log # This function replace pidof, not working in the same way in different linux distros pidof_pandora () { - COLUMNS=300 + COLUMNS=400 OS_NAME=`uname -s` if [ $OS_NAME = "HP-UX" ] then diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 05e84246ea..652ba51d2d 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -2,19 +2,19 @@ # ********************************************************************** # Pandora FMS Agent Installer for Unix (generic installer) -# (c) 2008-2009 Artica ST -# (c) 2008-2009 Sancho Lerena +# (c) 2008-2010 Artica ST +# (c) 2008-2010 Sancho Lerena # # This is a generic installer for all Unix-like systems.(AIX, HP-UX, SunOS, Linux) -# Please see http://www.pandorafms.org -# v3.0 Build 091215 -# This code is licensed under GPL 2.0 license. +# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION=3.0.0RC2 -PI_BUILD=091119 +PI_VERSION=3.1 +PI_BUILD=100515 OS_NAME=`uname -s` +FORCE=0 +LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` PANDORA_HOME=/usr/share/pandora_agent PANDORA_BIN=/usr/bin/pandora_agent PANDORA_TEMP=/var/spool/pandora @@ -22,24 +22,16 @@ PANDORA_CFG=/etc/pandora PANDORA_LOG_DIR=/var/log/pandora PANDORA_LOG=pandora_agent.log TENTACLE=/usr/bin/tentacle_client -FORCE=0 -USE_LINKS=0 - -LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` MODE=$1 +PANDORA_BASE=$2 -if [ ! -z "$2" ] -then - PANDORA_HOME=$2 -fi - -# Check for Perl 5.8.x available -PERL_VERSION=`perl -v | egrep 'v5.8|v5.9|v5.1[0-9]' | grep perl` +# Check for Perl 5.6.x or higher available +PERL_VERSION=`perl -v | egrep 'v5.6|v5.7|v5.8|v5.9|v5.1[0-9]' | grep perl` if [ -z "$PERL_VERSION" ] then - echo "Perl 5.8.x is not detected. This is required for Pandora FMS" + echo "Perl 5.6.x or higher is not detected. This is required for Pandora FMS" echo "Detected: $PERL_VERSION " echo "Aborting install..." exit 2 @@ -67,48 +59,56 @@ fi if [ ! -f "pandora_agent" ] then echo " " - echo "Execute installer from the directory where you have your files. For example:" + echo "Execute installer from the directory where you have your files. " + echo "Syntax": echo " " - echo " cd /tmp/pandora_install " + echo " ./pandora_agent_install < --mode > [ destination_path ]" + echo " " + echo "Some exaples of how to use the installer:" + echo " " + echo " cd /tmp/pandora_install " echo " ./pandora_agent_installer --install" echo " ./pandora_agent_installer --install-with-links /var/opt/PandoraFMS" + echo " ./pandora_agent_installer --install /opt/pandora" + echo " ./pandora_agent_installer --uninstall /opt/pandora" echo " " exit 1 fi uninstall () { echo "Removing Pandora FMS Agent..." - rm -Rf $PANDORA_BIN + rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null #Test if exist Pandora Server in this machine - if [ -d $PANDORA_TEMP/data_in ] + if [ -d $PANDORA_BASE$PANDORA_TEMP/data_in ] then echo "You have a Pandora Server in this machine. Then don't delete "$PANDORA_TEMP else - rm -Rf $PANDORA_TEMP - fi - rm -Rf $PANDORA_CFG/pandora_agent.conf + rm -Rf $PANDORA_BASE$PANDORA_TEMP 2> /dev/null + fi + rm -Rf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2> /dev/null - rm -Rf /etc/init.d/pandora_agent_daemon 2> /dev/null - rm -Rf /sbin/init.d/pandora_agent_daemon 2> /dev/null - rm -Rf /etc/rc.pandora_agent_daemon 2> /dev/null - rm -Rf /etc/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf /sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null + rm -Rf $PANDORA_BASE/etc/init.d/pandora_agent_daemon 2> /dev/null + rm -Rf $PANDORA_BASE/sbin/init.d/pandora_agent_daemon 2> /dev/null + rm -Rf $PANDORA_BASE/etc/rc.pandora_agent_daemon 2> /dev/null + rm -Rf $PANDORA_BASE/etc/rc?.d/S90pandora_agent_daemon 2> /dev/null + rm -Rf $PANDORA_BASE/sbin/rc?.d/S90pandora_agent_daemon 2> /dev/null - rm -Rf $PANDORA_HOME - rm -Rf $PANDORA_LOG_DIR - rm -Rf $TENTACLE + rm -Rf $PANDORA_BASE$PANDORA_HOME 2> /dev/null + rm -Rf $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null + rm -Rf $PANDORA_BASE$TENTACLE 2> /dev/null # Skip delete of /etc/pandora if exists configuration of a server - if [ ! -f /etc/pandora/pandora_server.conf ] + if [ ! -f $PANDORA_BASE/etc/pandora/pandora_server.conf ] then - rm -Rf /etc/pandora + rm -Rf $PANDORA_BASE/etc/pandora 2> /dev/null fi - echo "If you install Pandora FMS agent in a custom directory, you should" - echo " delete it yourself with command rm -Rf , for example:" - echo " " - echo " rm -Rf /opt/software/pandora" + if [ ! -z "$PANDORA_BASE" ] + then + echo "Please delete manually $PANDORA_BASE for complete uninstall" + fi + echo " " echo "Done" } @@ -119,99 +119,131 @@ install () { OS_NAME=`uname -s` OLDFILENAMETMP=`date +"%Y-%m-%d"` echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION" - if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ] + if [ -f $PANDORA_BASE$PANDORA_HOME ] && [ "$FORCE" = "0" ] then echo "Seems that default dir already exists. Please use --force to" - echo "force installer to install on $PANDORA_HOME" + echo "force installer to install on $PANDORA_BASE$PANDORA_HOME" exit else - echo "Checking default dir $PANDORA_HOME..." + echo "Checking default dir $PANDORA_BASE$PANDORA_HOME..." fi - if [ -f $PANDORA_BIN ] && [ "$FORCE" = "0" ] + if [ -f $PANDORA_BASE$PANDORA_BIN ] && [ "$FORCE" = "0" ] then - echo "Seems that $PANDORA_BIN already exists. Please use --force to" + echo "Seems that $PANDORA_BASE$PANDORA_BIN already exists. Please use --force to" echo "force installer to reinstall overwriting it" echo " " exit else - echo "Checking Pandora FMS Agent on $PANDORA_BIN...." + echo "Checking Pandora FMS Agent on $PANDORA_BASE$PANDORA_BIN...." fi - echo "Creating Pandora FMS Agent home directory at $PANDORA_HOME ..." - mkdir -p $PANDORA_HOME 2> /dev/null - - # IF USE_LINKS = 1 then append HOME to other paths - if [ "$USE_LINKS" = 1 ] - then - mkdir -p $PANDORA_HOME/$PANDORA_TEMP/data_out 2> /dev/null - mkdir -p $PANDORA_LOG_DIR 2> /dev/null - - ln -s $PANDORA_HOME /etc/pandora - ln -s $PANDORA_HOME/$PANDORA_TEMP /var/spool/pandora - else - # Create directories on / - mkdir -p $PANDORA_TEMP/data_out 2> /dev/null - mkdir -p $PANDORA_CFG 2> /dev/null - mkdir -p $PANDORA_LOG_DIR 2> /dev/null - fi + echo "Creating Pandora FMS Agent home directory at $PANDORA_BASE$PANDORA_HOME" + if [ ! -z "$PANDORA_BASE" ] + then + mkdir -p $PANDORA_BASE 2> /dev/null + mkdir -p $PANDORA_BASE/usr/bin 2> /dev/null + mkdir -p $PANDORA_BASE/var/log 2> /dev/null + mkdir -p $PANDORA_BASE/usr/share/man/man1 2> /dev/null + fi + + mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null + + # Create directories based on PANDORA_BASE + + mkdir -p $PANDORA_BASE/tmp 2> /dev/null + mkdir -p $PANDORA_BASE$PANDORA_TEMP/data_out 2> /dev/null + mkdir -p $PANDORA_BASE$PANDORA_CFG 2> /dev/null + mkdir -p $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null # Create logfile - if [ ! -z "`touch $PANDORA_LOG_DIR/$PANDORA_LOG`" ] + if [ ! -z "`touch $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG`" ] then - echo "Seems to be a problem generating logfile ($PANDORA_LOG_DIR/$PANDORA_LOG) please check it"; + echo "Seems to be a problem generating logfile ($PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG) please check it"; else - echo "Created logfile at $PANDORA_LOG_DIR/$PANDORA_LOG..." + echo "Created logfile at $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG..." fi - - echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_LOG_DIR/$PANDORA_LOG + echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG # Copying agent and securing it - echo "Copying Pandora FMS Agent to $PANDORA_BIN..." - cp pandora_agent $PANDORA_BIN - chmod 755 $PANDORA_BIN - chown root:root $PANDORA_BIN + echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..." + cp pandora_agent $PANDORA_BASE$PANDORA_BIN + chmod 755 $PANDORA_BASE$PANDORA_BIN + chown root:root $PANDORA_BASE$PANDORA_BIN - echo "Copying Pandora FMS Agent configuration file to $PANDORA_HOME/pandora_agent.conf..." - if [ -f /etc/pandora/pandora_agent.conf ] + echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_HOME/pandora_agent.conf..." + if [ -f $PANDORA_BASE/etc/pandora/pandora_agent.conf ] then - cat /etc/pandora/pandora_agent.conf > /etc/pandora/pandora_agent.conf.$OLDFILENAMETMP - echo "Backing up old configuration file to /etc/pandora_agent.conf.$OLDFILENAMETMP" + cp $PANDORA_BASE/etc/pandora/pandora_agent.conf $PANDORA_BASE/etc/pandora/pandora_agent.conf.$OLDFILENAMETMP + echo "Backing up old configuration file to $PANDORA_BASE/etc/pandora_agent.conf.$OLDFILENAMETMP" fi - - echo "Copying default agent configuration to $PANDORA_HOME/pandora_agent.conf" - cp $OS_NAME/pandora_agent.conf $PANDORA_HOME/pandora_agent.conf - chmod 600 $PANDORA_HOME/pandora_agent.conf - chown root $PANDORA_HOME/pandora_agent.conf - echo "Copying Pandora FMS Agent plugins to $PANDORA_HOME/plugins..." - cp -r plugins $PANDORA_HOME - chmod -R 700 $PANDORA_HOME/plugins + echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..." + cp -r plugins $PANDORA_BASE$PANDORA_HOME + chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins + ln -s $PANDORA_BASE$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG - echo "Copying tentacle client to $TENTACLE" - cp tentacle_client $TENTACLE - chmod 755 $TENTACLE + echo "Copying tentacle client to $PANDORA_BASE$TENTACLE" + cp tentacle_client $PANDORA_BASE$TENTACLE + chmod 755 $PANDORA_BASE$TENTACLE echo "Installing Tentacle Client manual" - cp ../man/man1/tentacle_client.1.gz /usr/share/man/man1 - - if [ "$USE_LINKS" != 1 ] - then - echo "Linking Pandora FMS Agent plugins directory to $PANDORA_CFG/plugins..." - rm $PANDORA_CFG/plugins 2> /dev/null - ln -s $PANDORA_HOME/plugins $PANDORA_CFG/plugins 2> /dev/null - - echo "Linking Pandora FMS Agent configuration to $PANDORA_CFG/pandora_agent.conf..." - rm $PANDORA_CFG/pandora_agent.conf 2> /dev/null - ln -s $PANDORA_HOME/pandora_agent.conf $PANDORA_CFG/pandora_agent.conf - fi + if [ -e ../man/man1/tentacle_client.1.gz ] + then + cp ../man/man1/tentacle_client.1.gz $PANDORA_BASE/usr/share/man/man1 + else + cp man/man1/tentacle_client.1.gz $PANDORA_BASE/usr/share/man/man1 + fi + chmod 644 $PANDORA_BASE/usr/share/man/man1/tentacle_client.1.gz echo "Setting secure permissions and ownership for all Pandora FMS Agent files..." - chown -R root $PANDORA_HOME - chmod -R 600 $PANDORA_TEMP - chown root $PANDORA_TEMP - chmod 640 $PANDORA_LOG_DIR/$PANDORA_LOG - chown root:root $PANDORA_LOG_DIR/$PANDORA_LOG + chown -R root $PANDORA_BASE$PANDORA_HOME + chmod -R 600 $PANDORA_BASE$PANDORA_TEMP + chown root $PANDORA_BASE$PANDORA_TEMP + chmod 640 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG + chown root:root $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG + + # Alter dynamically the daemon launcher and setup the new path + # if PANDORA_BASE is customized. + + if [ ! -z "$PANDORA_BASE" ] + then + DAEMON_SCRIPT=pandora_agent_daemon + DAEMON_TEMP=pandora_agent_daemon_temp + + AGENT_CFG=$OS_NAME/pandora_agent.conf + AGENT_CFG_TEMP=$OS_NAME/pandora_agent.conf.temp + + echo $PANDORA_BASE > PANDORA_BASE.temp + sed 's/\//\\\//g' PANDORA_BASE.temp > PANDORA_BASE.temp2 + + PANDORA_BASE_DECODED=`cat PANDORA_BASE.temp2` + rm PANDORA_BASE.temp PANDORA_BASE.temp2 + + sed -e "s/^PATH\=[.]*/PATH\=$PANDORA_BASE_DECODED\/usr\/bin\:/g" $DAEMON_SCRIPT > $DAEMON_TEMP + mv $DAEMON_TEMP $DAEMON_SCRIPT + + sed -e "s/^PANDORA_PATH\=[.]*/PANDORA_PATH\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP + mv $DAEMON_TEMP $DAEMON_SCRIPT + + sed -e "s/^LOGFILE\=[.]*/LOGFILE\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP + mv $DAEMON_TEMP $DAEMON_SCRIPT + + sed -e "s/^DAEMON\=[.]*/DAEMON\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP + mv $DAEMON_TEMP $DAEMON_SCRIPT + + sed -e "s/^temporal [.]*/temporal $PANDORA_BASE_DECODED/g" $AGENT_CFG > $AGENT_CFG_TEMP + mv $AGENT_CFG_TEMP $AGENT_CFG + + sed -e "s/^logfile [.]*/logfile $PANDORA_BASE_DECODED/g" $AGENT_CFG > $AGENT_CFG_TEMP + mv $AGENT_CFG_TEMP $AGENT_CFG + fi + + echo "Copying default agent configuration to $PANDORA_BASE$PANDORA_HOME/pandora_agent.conf" + + cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf + chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf + chown root $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf echo "Linking start-up daemon script 'pandora_agent_daemon' on $OS_NAME"; @@ -224,45 +256,55 @@ install () { if [ $OS_NAME = "HP-UX" ] then - cp pandora_agent_daemon /sbin/init.d/pandora_agent_daemon - ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc3.d/S90pandora_agent_daemon - ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc2.d/S90pandora_agent_daemon + PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon + cp pandora_agent_daemon $PANDORA_STARTUP + ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc3.d/S90pandora_agent_daemon 2> /dev/null + ln -s /sbin/init.d/pandora_agent_daemon /sbin/rc2.d/S90pandora_agent_daemon 2> /dev/null echo "Pandora FMS agent has been included in /sbin/rcX.d/S90pandora_agent_daemon" fi if [ $OS_NAME = "SunOS" ] then - cp pandora_agent_daemon /etc/init.d/pandora_agent_daemon - ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent_daemon + PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon + cp pandora_agent_daemon $PANDORA_STARTUP + ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent_daemon 2> /dev/null echo "Pandora FMS agent has been included in /etc/rc2.d/S90pandora_agent_daemon" fi if [ $OS_NAME = "Linux" ] then - cp pandora_agent_daemon /etc/init.d/pandora_agent_daemon + PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon + cp pandora_agent_daemon $PANDORA_STARTUP if [ -d /etc/rc.d/ ] then - ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent - ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc3.d/S90pandora_agent + ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent 2> /dev/null + ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/rc3.d/S90pandora_agent 2> /dev/null else - ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent - ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent + ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null + ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null fi fi echo "Installing Pandora Agent manual" - cp ../man/man1/pandora_agent.1.gz /usr/share/man/man1 + if [ -e ../man/man1/pandora_agent.1.gz ] + then + cp ../man/man1/pandora_agent.1.gz $PANDORA_BASE/usr/share/man/man1 + else + cp man/man1/pandora_agent.1.gz $PANDORA_BASE/usr/share/man/man1 + fi + chmod 644 $PANDORA_BASE/usr/share/man/man1/pandora_agent.1.gz echo "Done." echo " " echo "You have your startup script ready at $PANDORA_STARTUP" echo " " echo "Tentacle is the default transfer mode since 2.0 version." + echo " " echo "If you want to use SSH, firstly you need to copy your public SSH keys " echo " ($HOME/.ssh/id_dsa) under /home/pandora/.ssh/authorized_keys " echo "on your Pandora FMS Server host" echo " " - echo "You also need to setup your $PANDORA_CFG/pandora_agent.conf config file" + echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file" echo " " echo "Check your startup configuration to be sure Pandora FMS Agent is ready " echo "to start automatically when system restarts": @@ -270,22 +312,34 @@ install () { } help () { + echo "Syntax": + echo " " + echo " ./pandora_agent_install < --mode > [ destination_path ]" + echo " " + echo "Modes:" + echo " " echo " --force-install To force installation if already installed on system" echo " (Not compatible with --install-with-links " echo " --install To install Pandora FMS Agent on this system" echo " --uninstall To uninstall/remove Pandora FMS Agent on this System" - echo " --install-with-links " - echo " To install Pandora FMS in a defined dir " - echo " and set all Pandora FMS directories as links to this" + echo " " + echo "Some exaples of how to use the installer:" + echo " " + echo " cd /tmp/pandora_install " + echo " ./pandora_agent_installer --install" + echo " ./pandora_agent_installer --install /opt/pandora" + echo " ./pandora_agent_installer --uninstall /opt/pandora" + echo " " } # Script banner at start echo " " -echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2009 ArticaST" +echo "Pandora FMS Agent UNIX Installer $PI_VERSION $PI_BUILD (c) 2008-2010 ArticaST" echo "This program is licensed under GPL2 Terms. http://pandorafms.com" echo " " + case "$MODE" in '--force-install') @@ -299,12 +353,6 @@ case "$MODE" in exit ;; -'--install-with-links') - USE_LINKS=1 - install - exit - ;; - '--uninstall') uninstall exit