aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt/pandorafms_agent
diff options
context:
space:
mode:
authorWilliam Grzybowski <wg@FreeBSD.org>2014-08-20 20:01:17 +0000
committerWilliam Grzybowski <wg@FreeBSD.org>2014-08-20 20:01:17 +0000
commit582199510db502c680d3538a1b0112f3e6f2009a (patch)
treeadb6f8fd0786b54d43d2576035a6ddfe2d0b8298 /net-mgmt/pandorafms_agent
parent2c9868acf9f2e3603d7cc4b4f5b823089c519f08 (diff)
downloadports-582199510db502c680d3538a1b0112f3e6f2009a.tar.gz
ports-582199510db502c680d3538a1b0112f3e6f2009a.zip
net-mgmt/pandorafms_*: update to 5.1 and support stage
- Pass maintainership back - Add patches already incorporated upstream PR: 192739 Submitted by: KIKUCHI Koichiro
Notes
Notes: svn path=/head/; revision=365508
Diffstat (limited to 'net-mgmt/pandorafms_agent')
-rw-r--r--net-mgmt/pandorafms_agent/Makefile62
-rw-r--r--net-mgmt/pandorafms_agent/distinfo4
-rw-r--r--net-mgmt/pandorafms_agent/files/pandora_agent.in34
-rw-r--r--net-mgmt/pandorafms_agent/files/patch-pandora_agent_installer105
-rw-r--r--net-mgmt/pandorafms_agent/files/patch-update1288
-rw-r--r--net-mgmt/pandorafms_agent/pkg-descr2
-rw-r--r--net-mgmt/pandorafms_agent/pkg-plist39
7 files changed, 1329 insertions, 205 deletions
diff --git a/net-mgmt/pandorafms_agent/Makefile b/net-mgmt/pandorafms_agent/Makefile
index 41b6d7618795..fcfe9a58bd77 100644
--- a/net-mgmt/pandorafms_agent/Makefile
+++ b/net-mgmt/pandorafms_agent/Makefile
@@ -2,84 +2,48 @@
# $FreeBSD$
PORTNAME= pandora_agent
-PORTVERSION= ${PANDORA_VERSION}
-PORTREVISION= 1
CATEGORIES= net-mgmt
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= koichiro@rworks.jp
COMMENT= Pandora FMS agent, Perl version
LICENSE= ${PANDORA_LICENSE}
LICENSE_FILE= ${PANDORA_LICENSE_FILE}
-OPTIONS_DEFINE= TENTACLE_SERVER
-OPTIONS_DEFAULT= TENTACLE_SERVER
+OPTIONS_DEFINE= DOCS TENTACLE_SERVER
+OPTIONS_DEFAULT= DOCS TENTACLE_SERVER
TENTACLE_SERVER_DESC= Install tentalce_server
USES= perl5
-SUB_LIST+= PERL="${PERL}"
-
-MAN1= pandora_agent.1 tentacle_client.1
-MANCOMPRESSED= yes
SUB_FILES= pkg-message
-USE_RC_SUBR= ${PORTNAME}
-NO_STAGE= yes
.include "${.CURDIR}/../pandorafms_server/bsd.pandora.mk"
PORTDOCS+= README
+PANDORA_INSTALLER_ARGS+= --fakeroot
.include <bsd.port.pre.mk>
.if ${PORT_OPTIONS:MTENTACLE_SERVER}
-CONFLICTS= pandora_server-4*
+CONFLICTS= pandora_server-[45]*
PLIST_SUB+= TENTACLE_SERVER=""
.else
PLIST_SUB+= TENTACLE_SERVER="@comment "
+PANDORA_INSTALLER_ARGS+= --no-tentacle-server
.endif
-post-patch:
-.if ! ${PORT_OPTIONS:MTENTACLE_SERVER}
- @${REINPLACE_CMD} \
- -e '/TENTACLE_SERVER/s/^/#/' \
- ${WRKSRC}/pandora_agent_installer
-.endif
- @${REINPLACE_CMD} -E \
- -e 's|%%PREFIX%%|${PREFIX}|g' \
- -e 's|%%DATADIR%%|${DATADIR}|g' \
- -e 's|%%MAN1PREFIX%%|${MAN1PREFIX}|g' \
- -e 's|%%PANDORA_ETCDIR%%|${PANDORA_ETCDIR}|g' \
- -e 's|%%PANDORA_HOMEDIR%%|${PANDORA_HOMEDIR}|g' \
- ${WRKSRC}/pandora_agent_installer
- @${REINPLACE_CMD} -i "" \
- -e 's,/bin/bash,/bin/sh,' \
- -e 's,md5sum,md5 -r,' \
- ${WRKSRC}/plugins/files_indir
- @${REINPLACE_CMD} -i "" \
- -e 's,/usr/bin/perl,${PERL},g' \
- `${GREP} -lr /usr/bin/perl ${WRKSRC} | ${GREP} -v pandora_agent_installer`
- @${REINPLACE_CMD} -i "" \
- -e 's,/usr/local,${PREFIX},g' \
- ${WRKSRC}/plugins/pandora_update
- @${REINPLACE_CMD} \
- -e 's,`ifconfig ,`/sbin/ifconfig ,g' \
- -e 's,tentacle_client ,${PREFIX}/bin/tentacle_client ,g' \
- ${WRKSRC}/pandora_agent
+PANDORA_INSTALLER_ARGS+= ${STAGEDIR} root ${PERL}
-do-install:
- @cd ${WRKSRC} && ${SH} pandora_agent_installer --force-install
+post-patch:
+ @${REINPLACE_CMD} -e '\|PREFIX=|s|=[^;]*|=${PREFIX}|' ${WRKSRC}/pandora_agent_installer
post-install:
-.if ${PORT_OPTIONS:MDOCS}
- @${MKDIR} ${DOCSDIR}
+ @${RM} -f ${STAGEDIR}${LOGDIR}/pandora_agent.log
+ @${MKDIR} ${STAGEDIR}${DOCSDIR}
.for x in ${PORTDOCS}
- @${INSTALL_DATA} ${WRKSRC}/${x} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/${x} ${STAGEDIR}${DOCSDIR}
.endfor
-.endif
- @if [ ! -e ${ETCDIR}/pandora_agent.conf ]; then \
- cd ${ETCDIR} && ${CP} -p pandora_agent.conf.sample pandora_agent.conf; \
- fi
- @${CAT} ${PKGMESSAGE}
+ @${MV} ${STAGEDIR}${ETCDIR}/pandora_agent.conf ${STAGEDIR}${ETCDIR}/pandora_agent.conf.sample
.include <bsd.port.post.mk>
diff --git a/net-mgmt/pandorafms_agent/distinfo b/net-mgmt/pandorafms_agent/distinfo
index 3293e25ddea3..6b521f141db3 100644
--- a/net-mgmt/pandorafms_agent/distinfo
+++ b/net-mgmt/pandorafms_agent/distinfo
@@ -1,2 +1,2 @@
-SHA256 (pandora/pandorafms_agent_unix-4.0.1.tar.gz) = 0bae97d97f0fe628c7cd601d5d0304057a45b49a1277d63d9f30ae957173ed56
-SIZE (pandora/pandorafms_agent_unix-4.0.1.tar.gz) = 65952
+SHA256 (pandora/pandorafms_agent_unix-5.1.tar.gz) = 9d487573716c088a5121fbb89456000bd39226dbb317ed2d88970f46d4b2bc34
+SIZE (pandora/pandorafms_agent_unix-5.1.tar.gz) = 86100
diff --git a/net-mgmt/pandorafms_agent/files/pandora_agent.in b/net-mgmt/pandorafms_agent/files/pandora_agent.in
deleted file mode 100644
index 0caa3bee658e..000000000000
--- a/net-mgmt/pandorafms_agent/files/pandora_agent.in
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-# PROVIDE: pandora_agent
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-
-# Add the following line to /etc/rc.conf to enable `pandora_agent':
-#
-# pandora_agent_enable="YES"
-#
-
-. "/etc/rc.subr"
-
-name="pandora_agent"
-rcvar=`set_rcvar`
-load_rc_config "$name"
-
-# set defaults
-: ${pandora_agent_enable:=NO}
-
-pidfile="/var/run/$name.pid"
-
-required_files="%%ETCDIR%%/pandora_agent.conf"
-
-command="/usr/sbin/daemon"
-command_args="-cf -p ${pidfile} %%PREFIX%%/bin/pandora_agent %%ETCDIR%%"
-procname="%%PERL%%"
-stop_postcmd=stop_postcmd
-
-stop_postcmd() {
- rm -f $pidfile
-}
-
-run_rc_command "$1"
diff --git a/net-mgmt/pandorafms_agent/files/patch-pandora_agent_installer b/net-mgmt/pandorafms_agent/files/patch-pandora_agent_installer
deleted file mode 100644
index e888b1798e62..000000000000
--- a/net-mgmt/pandorafms_agent/files/patch-pandora_agent_installer
+++ /dev/null
@@ -1,105 +0,0 @@
---- pandora_agent_installer.orig 2011-12-07 16:18:47.219413617 +0900
-+++ pandora_agent_installer 2011-12-07 16:31:35.483681456 +0900
-@@ -180,13 +159,13 @@ install () {
-
- if [ "$OS_NAME" = "FreeBSD" ]
- then
-- PANDORA_HOME=/usr/local/share/pandora_agent
-- PANDORA_BIN=/usr/local/bin/pandora_agent
-- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec
-- PANDORA_CFG=/usr/local/etc/pandora
-- TENTACLE=/usr/local/bin/tentacle_client
-- TENTACLE_SERVER=/usr/local/bin/tentacle_server
-- PANDORA_MAN=/usr/local/man
-+ PANDORA_HOME=%%DATADIR%%
-+ PANDORA_BIN=%%PREFIX%%/bin/pandora_agent
-+ PANDORA_EXEC_BIN=%%PREFIX%%/bin/pandora_agent_exec
-+ PANDORA_CFG=%%PANDORA_ETCDIR%%
-+ TENTACLE=%%PREFIX%%/bin/tentacle_client
-+ TENTACLE_SERVER=%%PREFIX%%/bin/tentacle_server
-+ PANDORA_MAN=%%MAN1PREFIX%%/man
- fi
-
- echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
-@@ -302,15 +281,6 @@ install () {
- PANDORA_USER="root"
- fi
-
-- # Create logfile
-- if [ ! -z "`touch $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG`" ]
-- then
-- echo "Seems to be a problem generating logfile ($PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG) please check it";
-- else
-- 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_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
--
- # Copying agent and securing it
- echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..."
- cp pandora_agent $PANDORA_BASE$PANDORA_BIN
-@@ -326,22 +296,23 @@ install () {
- chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_EXEC_BIN
- fi
-
-- echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf..."
-- if [ -f $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf ]
-- then
-- cp $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP
-- echo "Backing up old configuration file to $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf.$OLDFILENAMETMP"
-- fi
--
- 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
-+ mkdir -p $PANDORA_BASE$PANDORA_CFG/plugins
-+ for _p in `find $PANDORA_BASE$PANDORA_HOME/plugins -mindepth 1 -maxdepth 1 -type f ! -name "*.bak"`
-+ do
-+ ln -s $_p $PANDORA_BASE$PANDORA_CFG/plugins/ || exit 1
-+ done
-
- echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
- cp -r collections $PANDORA_BASE$PANDORA_HOME
- chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
-- ln -s $PANDORA_BASE$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
-+ mkdir -p $PANDORA_BASE$PANDORA_CFG/collections
-+ for _p in `find $PANDORA_BASE$PANDORA_HOME/collections -mindepth 1 -maxdepth 1 -type f ! -name "*.bak"`
-+ do
-+ ln -s $_p $PANDORA_BASE$PANDORA_CFG/collections/ || exit 1
-+ done
-
- echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
- cp tentacle_server $PANDORA_BASE$TENTACLE_SERVER
-@@ -386,7 +357,7 @@ install () {
-
- echo "Copying default agent configuration to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf"
-
-- cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
-+ cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf.sample
- chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
- chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
- chmod 711 $PANDORA_BASE$PANDORA_LOG_DIR
-@@ -445,14 +416,6 @@ install () {
- chown root:0 $PANDORA_STARTUP
- fi
-
-- if [ "$OS_NAME" = "FreeBSD" ]
-- then
-- PANDORA_STARTUP=/usr/local/etc/rc.d/pandora_agent
-- cp FreeBSD/pandora_agent $PANDORA_STARTUP
-- chmod 555 $PANDORA_STARTUP
-- chown root:wheel $PANDORA_STARTUP
-- fi
--
- echo "Done."
- echo " "
- echo "You have your startup script ready at $PANDORA_STARTUP"
-@@ -466,7 +423,7 @@ install () {
- 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 " ($HOME/.ssh/id_dsa) under %%PANDORA_HOMEDIR%%/.ssh/authorized_keys "
- echo "on your Pandora FMS Server host"
- echo " "
- echo "You also need to setup your $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf config file"
diff --git a/net-mgmt/pandorafms_agent/files/patch-update b/net-mgmt/pandorafms_agent/files/patch-update
new file mode 100644
index 000000000000..3cf74fe1ac4b
--- /dev/null
+++ b/net-mgmt/pandorafms_agent/files/patch-update
@@ -0,0 +1,1288 @@
+Index: ChangeLog
+===================================================================
+--- ChangeLog (revision 10314)
++++ ChangeLog (working copy)
+@@ -1,3 +1,33 @@
++2014-08-14 Koichiro Kikuchi <koichiro@rworks.jp>
++
++ * pandora_agent_installer: Fixed symlink source path.
++
++2014-08-13 Koichiro Kikuchi <koichiro@rworks.jp>
++
++ * FreeBSD/pandora_agent: Small fixes: use proper rc variables,
++ remove obsolete function "set_rcvar" call and use "daemon" command
++ to start pandora_agent.
++
++ * pandora_agent_installer: Refactored implementation and added
++ "fakeroot" installation support.
++
++ * plugins/who.sh: Converted to bourne shell script.
++
++ * pandora_agent_daemon: Small bug fixes and refactorings.
++
++2014-08-12 Ramon Novoa <rnovoa@artica.es>
++
++ * pandora_agent: Fixed to make the 'Command Snapshot' feature work.
++
++2014-08-12 Ramon Novoa <rnovoa@artica.es>
++
++ * pandora_agent: Trim leading and trailing whitespaces from module names
++ (like policies and windows agents do).
++
++2014-08-07 Ramon Novoa <rnovoa@artica.es>
++
++ * pandora_agent_daemon: Fixes the ps call on HP-UX.
++
+ 2014-06-04 Koichiro KIKUCHI <koichiro@rworks.jp>
+
+ * pandora_agent: Allow spaces in module group names.
+Index: pandora_agent_installer
+===================================================================
+--- pandora_agent_installer (revision 10314)
++++ pandora_agent_installer (working copy)
+@@ -15,49 +15,79 @@
+
+ FORCE=0
+ LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
+-PANDORA_HOME=/usr/share/pandora_agent
+-PANDORA_BIN=/usr/bin/pandora_agent
+-PANDORA_EXEC_BIN=/usr/bin/pandora_agent_exec
+-PANDORA_REVENT_BIN=/usr/bin/pandora_revent
++
++PREFIX=/usr
++if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
++then
++ PREFIX=/usr/local
++fi
++PANDORA_HOME=$PREFIX/share/pandora_agent
++PANDORA_BIN=$PREFIX/bin/pandora_agent
++PANDORA_EXEC_BIN=$PREFIX/bin/pandora_agent_exec
++PANDORA_REVENT_BIN=$PREFIX/bin/pandora_revent
+ PANDORA_TEMP=/var/spool/pandora
+ PANDORA_CFG=/etc/pandora
+ PANDORA_LOG_DIR=/var/log/pandora
+ PANDORA_LOG=pandora_agent.log
+-TENTACLE=/usr/bin/tentacle_client
+-TENTACLE_SERVER=/usr/bin/tentacle_server
+-PANDORA_MAN=/usr/share/man
++TENTACLE=$PREFIX/bin/tentacle_client
++TENTACLE_SERVER=$PREFIX/bin/tentacle_server
++PANDORA_MAN=$PREFIX/share/man
++PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
++DAEMON_SCRIPT=pandora_agent_daemon
++PANDORA_USER="root"
++PANDORA_PERL_PATH="perl"
++WITHOUT_TENTACLE_SERVER=0
++FAKEROOT=0
+
++# defaults for each platforms
++case $OS_NAME in
++AIX)
++ PANDORA_STARTUP=/etc/rc.pandora_agent_daemon
++ ;;
++HP-UX)
++ PANDORA_STARTUP=/sbin/init.d/pandora_agent_daemon
++ ;;
++FreeBSD)
++ PANDORA_CFG=$PREFIX/etc/pandora
++ PANDORA_MAN=$PREFIX/man
++ PANDORA_STARTUP=$PREFIX/etc/rc.d/pandora_agent
++ DAEMON_SCRIPT=$OS_NAME/pandora_agent
++ PANDORA_PERL_PATH=/usr/local/bin/perl
++ ;;
++NetBSD)
++ PANDORA_CFG=/usr/local/etc/pandora
++ PANDORA_STARTUP=/etc/rc.d/pandora_agent
++ DAEMON_SCRIPT=$OS_NAME/pandora_agent
++ PANDORA_PERL_PATH=/usr/pkg/bin/perl
++ ;;
++esac
++
+ MODE=$1
+-PANDORA_BASE=`echo $2 | sed -e 's/\/$//'`
++
++# options
++while :
++do
++ case "$2" in
++ "--no-tentacle-server") WITHOUT_TENTACLE_SERVER=1;;
++ "--fakeroot") FAKEROOT=1;;
++ *) break;;
++ esac
++ shift
++done
++
++PANDORA_BASE=`echo $2 | sed -e 's|/$||'`
+ if [ "$3" != "" ]
+ then
+ PANDORA_USER=$3
+- if [ "$PANDORA_BASE" = "" ]
++ if [ -z "$PANDORA_BASE" ]
+ then
+ echo "When specifying a custom user the agent must be installed to a custom location where that user has write permissions!"
+ exit 1
+ fi
+-else
+- PANDORA_USER="root"
+ fi
+
+-if [ "$4" != "" ]
+-then
+- PANDORA_PERL_PATH=$4
+- echo $PANDORA_PERL_PATH > PANDORA_PERL_PATH.temp
+- sed 's/\//\\\//g' PANDORA_PERL_PATH.temp > PANDORA_PERL_PATH.temp2
++[ "$4" ] && PANDORA_PERL_PATH=$4
+
+- PANDORA_PERL_DECODED_PATH=`cat PANDORA_PERL_PATH.temp2`
+- rm PANDORA_PERL_PATH.temp PANDORA_PERL_PATH.temp2
+- #PANDORA_PERL_DECODED_PATH=`echo $PANDORA_PERL_PATH | sed -e "s.\/.\\\\\/.g"`
+-else
+- PANDORA_PERL_PATH="perl"
+- if [ "$OS_NAME" = "NetBSD" ]
+- then
+- PANDORA_PERL_DECODED_PATH="/usr/pkg/bin/perl"
+- fi
+-fi
+-
+ # Check for Perl 5.6.x or higher available
+ PERL_VERSION=`$PANDORA_PERL_PATH -v | egrep 'v5.6|v5.7|v5.8|v5.9|v5.1[0-9]' | grep perl`
+
+@@ -69,17 +99,16 @@
+ exit 2
+ fi
+
+-UNIX_KIND=`uname -s`
+-if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$UNIX_KIND\"`" ]
++if [ -z "`echo Linux HP-UX SunOS AIX Solaris Darwin BSD bsd FreeBSD NetBSD | grep \"$OS_NAME\"`" ]
+ then
+- echo "This system: '$UNIX_KIND' is not supported by this script"
++ echo "This system: '$OS_NAME' is not supported by this script"
+ echo "Please make the install yourself as it's described in documentation"
+ exit 1
+ fi
+
+
+ # check for root to do the install
+-if [ -z "`id | grep \"uid=0(root)\"`" ]
++if [ $FAKEROOT -ne 1 ] && [ -z "`id | grep \"uid=0(root)\"`" ]
+ then
+ echo "You need to be root to do the install. Please made a manual install"
+ echo "if you want to install Pandora FMS agent without root"
+@@ -91,7 +120,7 @@
+ help () {
+ echo "Syntax":
+ echo " "
+- echo " ./pandora_agent_installer < --mode > [ destination_path ] [ user_to_run_as ] [custom_perl_path]"
++ echo " ./pandora_agent_installer < --mode > [ --option ] [ destination_path ] [ user_to_run_as ] [custom_perl_path]"
+ echo " "
+ echo "Modes:"
+ echo " "
+@@ -99,6 +128,11 @@
+ echo " --install To install Pandora FMS Agent on this system"
+ echo " --uninstall To uninstall/remove Pandora FMS Agent on this System"
+ echo " "
++ echo "Option:"
++ echo " "
++ echo " --no-tentacle-server Skip tentacle server installation (by default tentalce server installed)"
++ echo " --fakeroot treate \"destination_path\" as root directory"
++ echo " "
+ echo "Some exaples of how to use the installer:"
+ echo " "
+ echo " ./pandora_agent_installer --install"
+@@ -110,38 +144,12 @@
+ }
+
+ uninstall () {
+- OS_NAME=`uname -s`
+-
+ if [ "$OS_NAME" = "Darwin" ]
+ then
+ launchctl remove com.pandorafms.pandorafms
+ rm /Library/LaunchDaemons/com.pandorafms.pandorafms.plist 2> /dev/null
+ fi
+
+-
+- if [ "$OS_NAME" = "FreeBSD" ]
+- then
+- PANDORA_HOME=/usr/local/share/pandora_agent
+- PANDORA_BIN=/usr/local/bin/pandora_agent
+- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec
+- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent
+- PANDORA_CFG=/usr/local/etc/pandora
+- TENTACLE=/usr/local/bin/tentacle_client
+- TENTACLE_SERVER=/usr/local/bin/tentacle_server
+- PANDORA_MAN=/usr/local/man
+- fi
+- if [ "$OS_NAME" = "NetBSD" ]
+- then
+- PANDORA_HOME=/usr/local/share/pandora_agent
+- PANDORA_BIN=/usr/local/bin/pandora_agent
+- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec
+- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent
+- PANDORA_CFG=/usr/local/etc/pandora
+- TENTACLE=/usr/local/bin/tentacle_client
+- TENTACLE_SERVER=/usr/local/bin/tentacle_server
+- PANDORA_MAN=/usr/share/man
+- fi
+-
+ echo "Removing Pandora FMS Agent..."
+ rm -Rf $PANDORA_BASE$PANDORA_BIN 2> /dev/null
+ rm -Rf $PANDORA_BASE$PANDORA_EXEC_BIN 2> /dev/null
+@@ -168,16 +176,19 @@
+ rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
+ rm -Rf $PANDORA_BASE/etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
+ rm -Rf $PANDORA_BASE/usr/local/etc/rc.d/pandora_agent 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 /etc/rc?.d/S90pandora_agent 2> /dev/null
+- rm -Rf /sbin/rc?.d/S90pandora_agent 2> /dev/null
+- rm -Rf /etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
+- rm -Rf /etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
+- rm -Rf /usr/local/etc/rc.d/pandora_agent 2> /dev/null
++ if [ $FAKEROOT -ne 1 ]
++ then
++ 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 /etc/rc?.d/S90pandora_agent 2> /dev/null
++ rm -Rf /sbin/rc?.d/S90pandora_agent 2> /dev/null
++ rm -Rf /etc/rc.d/rc?.d/S90pandora_agent_daemon 2> /dev/null
++ rm -Rf /etc/rc.d/rc?.d/S90pandora_agent 2> /dev/null
++ rm -Rf /usr/local/etc/rc.d/pandora_agent 2> /dev/null
++ fi
+
+ rm -Rf $PANDORA_BASE$PANDORA_HOME 2> /dev/null
+ rm -Rf $PANDORA_BASE$PANDORA_LOG_DIR 2> /dev/null
+@@ -201,36 +212,48 @@
+ echo "Done"
+ }
+
+-install () {
++#
++# install_perl_script [OPTIONS] SRCFILE DESTFILE
++# Install perl script. If PANDORA_PERL_DECODED_PATH is set, path of the perl
++# in shebang line is replaced with PANDORA_PERL_DECODED_PATH value.
++# OPTIONS:
++# -o OWNER owner of the installed script
++# -g GROUP group of the installed script
++# -m PREM mode of the installed script
++#
++install_perl_script () {
++ OWNER=""; GROUP=""; PERM=""
++ while :
++ do
++ case $1 in
++ -o) OWNER=$2;;
++ -g) GROUP=$2;;
++ -m) PERM=$2;;
++ *) break;;
++ esac
++ shift;shift
++ done
++ SRC="$1"
++ DEST="$2"
+
+- OS_VERSION=`uname -r`
+- OS_NAME=`uname -s`
+- OLDFILENAMETMP=`date +"%Y-%m-%d"`
+-
+- if [ "$OS_NAME" = "FreeBSD" ]
++ # do install
++ if echo $PANDORA_PERL_PATH | grep "/" > /dev/null && [ "$PANDORA_PERL_PATH" != "/usr/bin/perl" ]
+ then
+- PANDORA_HOME=/usr/local/share/pandora_agent
+- PANDORA_BIN=/usr/local/bin/pandora_agent
+- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec
+- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent
+- PANDORA_CFG=/usr/local/etc/pandora
+- TENTACLE=/usr/local/bin/tentacle_client
+- TENTACLE_SERVER=/usr/local/bin/tentacle_server
+- PANDORA_MAN=/usr/local/man
++ sed -e "s:^#\!.*:#\!$PANDORA_PERL_PATH:g" $SRC > $DEST
++ else
++ cp $SRC $DEST
+ fi
+
+- if [ "$OS_NAME" = "NetBSD" ]
+- then
+- PANDORA_HOME=/usr/local/share/pandora_agent
+- PANDORA_BIN=/usr/local/bin/pandora_agent
+- PANDORA_EXEC_BIN=/usr/local/bin/pandora_agent_exec
+- PANDORA_REVENT_BIN=/usr/local/bin/pandora_revent
+- PANDORA_CFG=/usr/local/etc/pandora
+- TENTACLE=/usr/local/bin/tentacle_client
+- TENTACLE_SERVER=/usr/local/bin/tentacle_server
+- PANDORA_MAN=/usr/share/man
+- fi
++ # set owner, group and permissions
++ [ "$OWNER" ] && chown $OWNER $DEST 2>/dev/null
++ [ "$GROUP" ] && chgrp $GROUP $DEST 2>/dev/null
++ [ "$PERM" ] && chmod $PERM $DEST
++}
+
++install () {
++ OS_VERSION=`uname -r`
++ OLDFILENAMETMP=`date +"%Y-%m-%d"`
++
+ echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
+ if [ -f $PANDORA_BASE$PANDORA_HOME ] && [ "$FORCE" = "0" ]
+ then
+@@ -253,87 +276,49 @@
+
+ # Alter dynamically the daemon launcher and setup the new path
+ # if PANDORA_BASE is customized.
+- if [ ! -z "$PANDORA_BASE" ]
++ if [ "$PANDORA_BASE" ] && [ $FAKEROOT -ne 1 ]
+ then
+- if [ "$OS_NAME" = "FreeBSD" ]
+- then
+- DAEMON_SCRIPT=FreeBSD/pandora_agent
+- DAEMON_TEMP=pandora_agent_daemon_temp
+- elif [ "$OS_NAME" = "NetBSD" ]
+- then
+- DAEMON_SCRIPT=NetBSD/pandora_agent
+- DAEMON_TEMP=pandora_agent_daemon_temp
+- else
+- DAEMON_SCRIPT=pandora_agent_daemon
+- DAEMON_TEMP=pandora_agent_daemon_temp
+- fi
++ DAEMON_TEMP=pandora_agent_daemon_temp
+
+ # Backup the daemon script
+- cp -f "$DAEMON_SCRIPT" "$DAEMON_SCRIPT.bak"
++ cp -f "$DAEMON_SCRIPT" "${DAEMON_SCRIPT}.bak"
+
+ AGENT_CFG=$OS_NAME/pandora_agent.conf
+ AGENT_CFG_TEMP=$OS_NAME/pandora_agent.conf.temp
+
+ # Backup the configuration file
+- cp -f "$AGENT_CFG" "$AGENT_CFG.bak"
++ cp -f "$AGENT_CFG" "${AGENT_CFG}.bak"
+
+- 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
+-
+- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ]
++ if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
+ then
+- sed -e "s/^PATH\=[.]*/PATH\=$PANDORA_BASE_DECODED\/usr\/local\/bin\:/g" $DAEMON_SCRIPT > $DAEMON_TEMP
++ sed -e "\|^PATH=|s|=|=$PANDORA_BASE$PREFIX/bin:|" \
++ -e "s|/usr/local/etc/pandora|$PANDORA_BASE$PANDORA_CFG|g" \
++ -e "s|/usr/local/bin/pandora_agent|$PANDORA_BASE$PANDORA_BIN|g" \
++ $DAEMON_SCRIPT > $DAEMON_TEMP
+ mv $DAEMON_TEMP $DAEMON_SCRIPT
+-
+- sed -e "s/^command\=[.]*/command\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP
+- mv $DAEMON_TEMP $DAEMON_SCRIPT
+-
+- sed -e 's/^command_args\=\"[.]*/command_args\=\"$PANDORA_BASE_DECODED/g' $DAEMON_SCRIPT > $DAEMON_TEMP
+- mv $DAEMON_TEMP $DAEMON_SCRIPT
+-
+- sed -e 's/^required_files\=\"[.]*/required_files\=\"$PANDORA_BASE_DECODED/g' $DAEMON_SCRIPT > $DAEMON_TEMP
+- mv $DAEMON_TEMP $DAEMON_SCRIPT
+ else
+- sed -e "s/^PATH\=[.]*/PATH\=$PANDORA_BASE_DECODED\/usr\/bin\:/g" $DAEMON_SCRIPT > $DAEMON_TEMP
++ sed -e "\|^PATH=|s|=|=$PANDORA_BASE/usr/bin:|" \
++ -e "\|^PANDORA_PATH=|s|=|=$PANDORA_BASE|" \
++ -e "\|^LOGFILE=|s|=|=$PANDORA_BASE|" \
++ -e "\|^DAEMON=|s|=|=$PANDORA_BASE|" \
++ -e "\|^DAEMON_TENTACLE=|s|=|=$PANDORA_BASE|" \
++ -e "s/^PANDORA_USER=.*/PANDORA_USER=$PANDORA_USER/" \
++ $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/^DAEMON_TENTACLE\=[.]*/DAEMON_TENTACLE\=$PANDORA_BASE_DECODED/g" $DAEMON_SCRIPT > $DAEMON_TEMP
+- mv $DAEMON_TEMP $DAEMON_SCRIPT
+-
+- sed -e "s/^PANDORA_USER\=.*/PANDORA_USER\=$PANDORA_USER/g" $DAEMON_SCRIPT > $DAEMON_TEMP
+- mv $DAEMON_TEMP $DAEMON_SCRIPT
+ fi
+
+- sed -e "s/^temporal [.]*/temporal $PANDORA_BASE_DECODED/g" $AGENT_CFG > $AGENT_CFG_TEMP
++ sed -e "s|^temporal[ ]*|temporal $PANDORA_BASE|" \
++ -e "s|^logfile[ ]*|logfile $PANDORA_BASE|" \
++ $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 "Creating Pandora FMS Agent home directory at $PANDORA_BASE$PANDORA_HOME"
+- if [ ! -z "$PANDORA_BASE" ]
++ if [ "$PANDORA_BASE" ]
+ then
+ mkdir -p $PANDORA_BASE 2> /dev/null
+ mkdir -p $PANDORA_BASE/var/log 2> /dev/null
+ mkdir -p $PANDORA_BASE/$PANDORA_MAN/man1 2> /dev/null
+- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ]
+- then
+- mkdir -p $PANDORA_BASE/usr/local/bin 2> /dev/null
+- else
+- mkdir -p $PANDORA_BASE/usr/bin 2> /dev/null
+- fi
++ mkdir -p $PANDORA_BASE$PREFIX/bin 2> /dev/null
+ fi
+
+ mkdir -p $PANDORA_BASE$PANDORA_HOME 2> /dev/null
+@@ -344,14 +329,14 @@
+ 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
+-
++
+ # Set the user the agent will run as
+ if [ "$PANDORA_USER" != "root" ]
+ then
+ sed -e "s/.*pandora_user .*/pandora_user $PANDORA_USER/" $AGENT_CFG > $AGENT_CFG_TEMP 2> /dev/null && \
+- mv $AGENT_CFG_TEMP $AGENT_CFG
++ mv $AGENT_CFG_TEMP $AGENT_CFG
+ chmod 755 pandora_agent_daemon
+- chown -R $PANDORA_USER $PANDORA_BASE
++ chown -R $PANDORA_USER $PANDORA_BASE 2>/dev/null
+ fi
+
+ # Create logfile
+@@ -365,32 +350,10 @@
+
+ # Copying agent and securing it
+ echo "Copying Pandora FMS Agent to $PANDORA_BASE$PANDORA_BIN..."
++ install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent $PANDORA_BASE$PANDORA_BIN
++ install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN
++ install_perl_script -m 755 -o $PANDORA_USER -g 0 pandora_revent $PANDORA_BASE$PANDORA_REVENT_BIN
+
+- if [ "$PANDORA_PERL_DECODED_PATH" != "" ]
+- then
+- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_agent > $PANDORA_BASE$PANDORA_BIN
+- else
+- cp pandora_agent $PANDORA_BASE$PANDORA_BIN
+- fi
+- chmod 755 $PANDORA_BASE$PANDORA_BIN
+- if [ "$PANDORA_PERL_DECODED_PATH" != "" ]
+- then
+- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_agent_exec > $PANDORA_BASE$PANDORA_EXEC_BIN
+- else
+- cp pandora_agent_exec $PANDORA_BASE$PANDORA_EXEC_BIN
+- fi
+- chmod 755 $PANDORA_BASE$PANDORA_EXEC_BIN
+- if [ "$PANDORA_PERL_DECODED_PATH" != "" ]
+- then
+- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" pandora_revent > $PANDORA_BASE$PANDORA_REVENT_BIN
+- else
+- cp pandora_revent $PANDORA_BASE$PANDORA_REVENT_BIN
+- fi
+- chmod 755 $PANDORA_BASE$PANDORA_REVENT_BIN
+- chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_BIN
+- chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_EXEC_BIN
+- chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_REVENT_BIN
+-
+ echo "Copying Pandora FMS Agent configuration file to $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf..."
+ if [ -f $PANDORA_BASE/$PANDORA_CFG/pandora_agent.conf ]
+ then
+@@ -400,49 +363,36 @@
+
+ echo "Copying Pandora FMS Agent plugins to $PANDORA_BASE$PANDORA_HOME/plugins..."
+
+- if [ "$OS_NAME" = "NetBSD" ]
+- then
+- if [ ! -d $PANDORA_BASE$PANDORA_HOME/plugins ]
++ [ -d $PANDORA_BASE$PANDORA_HOME/plugins ] || mkdir -p $PANDORA_BASE$PANDORA_HOME/plugins >/dev/null 2>&1
++ for PLUGIN in plugins/*
++ do
++ if grep '^#!.*/perl' $PLUGIN >/dev/null 2>&1
+ then
+- mkdir -p $PANDORA_BASE$PANDORA_HOME/plugins
++ install_perl_script $PLUGIN $PANDORA_BASE$PANDORA_HOME/$PLUGIN
++ else
++ cp $PLUGIN $PANDORA_BASE$PANDORA_HOME/plugins
+ fi
+- for i in `ls -1 plugins`
+- do
+- sed s:/usr/bin/perl:/usr/pkg/bin/perl: plugins/$i > plugins/$i.tmp
+- cp plugins/$i.tmp $PANDORA_BASE$PANDORA_HOME/plugins/$i
+- rm plugins/$i.tmp
+- done
+- else
+- cp -r plugins $PANDORA_BASE$PANDORA_HOME
+- fi
+-
++ done
+ chmod -R 700 $PANDORA_BASE$PANDORA_HOME/plugins
+- ln -s $PANDORA_BASE$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
+
++ PANDORA_BASE_REAL="$PANDORA_BASE"
++ [ $FAKEROOT -eq 1 ] && PANDORA_BASE_REAL=""
++
++ ln -s $PANDORA_BASE_REAL$PANDORA_HOME/plugins $PANDORA_BASE$PANDORA_CFG
++
+ echo "Copying Pandora FMS Agent collections to $PANDORA_BASE$PANDORA_HOME/collections..."
+ cp -r collections $PANDORA_BASE$PANDORA_HOME
+ chmod -R 700 $PANDORA_BASE$PANDORA_HOME/collections
+- ln -s $PANDORA_BASE$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
++ ln -s $PANDORA_BASE_REAL$PANDORA_HOME/collections $PANDORA_BASE$PANDORA_CFG
+
+- echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
+- if [ "$PANDORA_PERL_DECODED_PATH" != "" ]
+- then
+- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" tentacle_server > $PANDORA_BASE$TENTACLE_SERVER
+- else
+- cp tentacle_server $PANDORA_BASE$TENTACLE_SERVER
+- fi
+- chmod 755 $PANDORA_BASE$TENTACLE_SERVER
+- chown $PANDORA_USER:0 $PANDORA_BASE$TENTACLE_SERVER
++ if [ $WITHOUT_TENTACLE_SERVER -eq 0 ]
++ then
++ echo "Copying tentacle server to $PANDORA_BASE$TENTACLE_SERVER"
++ install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_server $PANDORA_BASE$TENTACLE_SERVER
++ fi
+
+ echo "Copying tentacle client to $PANDORA_BASE$TENTACLE"
+- if [ "$PANDORA_PERL_DECODED_PATH" != "" ]
+- then
+- sed -e "s:^#\!.*:#\!$PANDORA_PERL_DECODED_PATH:g" tentacle_client > $PANDORA_BASE$TENTACLE
+- else
+- cp tentacle_client $PANDORA_BASE$TENTACLE
+- fi
+- chmod 755 $PANDORA_BASE$TENTACLE
+- chown $PANDORA_USER:0 $PANDORA_BASE$TENTACLE
++ install_perl_script -m 755 -o $PANDORA_USER -g 0 tentacle_client $PANDORA_BASE$TENTACLE
+
+ echo "Installing the Pandora Agent and Tentacle Client manuals"
+ cp man/man1/tentacle_client.1.gz $PANDORA_BASE/$PANDORA_MAN/man1
+@@ -451,14 +401,14 @@
+ chmod 644 $PANDORA_BASE/$PANDORA_MAN/man1/pandora_agent.1.gz
+
+ echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
+- chown -R $PANDORA_USER $PANDORA_BASE$PANDORA_HOME
++ chown -R $PANDORA_USER $PANDORA_BASE$PANDORA_HOME 2>/dev/null
+ chmod -R 700 $PANDORA_BASE$PANDORA_TEMP/data_out
+ chmod 711 $PANDORA_BASE$PANDORA_LOG_DIR
+ chmod 640 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
+- chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG
+- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ]
++ chown $PANDORA_USER:0 $PANDORA_BASE$PANDORA_LOG_DIR/$PANDORA_LOG 2>/dev/null
++ if [ "$OS_NAME" = "FreeBSD" ] || [ "$OS_NAME" = "NetBSD" ]
+ then
+- chown $PANDORA_USER:daemon $PANDORA_BASE$PANDORA_TEMP
++ chown $PANDORA_USER:daemon $PANDORA_BASE$PANDORA_TEMP 2>/dev/null
+ chmod -R 770 $PANDORA_BASE$PANDORA_TEMP
+ chmod 775 $PANDORA_BASE$PANDORA_TEMP
+ fi
+@@ -467,85 +417,55 @@
+
+ cp $OS_NAME/pandora_agent.conf $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
+ chmod 600 $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
+- chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf
++ chown $PANDORA_USER $PANDORA_BASE$PANDORA_CFG/pandora_agent.conf 2>/dev/null
+
+- if [ "$OS_NAME" = "FreeBSD" -o "$OS_NAME" = "NetBSD" ]
++ echo "Linking start-up daemon script '$DAEMON_SCRIPT' on $OS_NAME";
++
++ if [ "$OS_NAME" = "Darwin" ]
+ then
+- echo "Linking start-up daemon script 'pandora_agent' on $OS_NAME";
++ # Specific service install on Darwin/macOSX
++ launchctl load -F Darwin/com.pandorafms.pandorafms.plist
++ echo "Start Pandora FMS service with 'launchctl start com.pandorafms.pandorafms'"
++ echo "This service has been scheduled to launch on each system startup"
+ else
+- echo "Linking start-up daemon script 'pandora_agent_daemon' on $OS_NAME";
+- fi
++ DESTDIR=""
++ [ "$PANDORA_BASE" ] && [ $FAKEROOT -eq 1 ] && DESTDIR=$PANDORA_BASE
+
+- if [ "$OS_NAME" = "Darwin" ]
+- then
+- # Specific service install on Darwin/macOSX
+- launchctl load -F Darwin/com.pandorafms.pandorafms.plist
+- echo "Start Pandora FMS service with 'launchctl start com.pandorafms.pandorafms'"
+- echo "This service has been scheduled to launch on each system startup"
+- fi
++ cp $DAEMON_SCRIPT $DESTDIR$PANDORA_STARTUP
++ chmod 755 $DESTDIR$PANDORA_STARTUP
++ chown root:0 $DESTDIR$PANDORA_STARTUP 2>/dev/null
+
+- if [ "$OS_NAME" = "AIX" ]
+- then
+- cp pandora_agent_daemon /etc/rc.pandora_agent_daemon
+- ln -s /etc/rc.pandora_agent_daemon /etc/rc.d/rc2.d/S90pandora_agent_daemon
+- chmod 755 $PANDORA_STARTUP
+- chown root:0 $PANDORA_STARTUP
+- echo "Pandora FMS agent has been included in /etc/rc.d/rc2.d/S90pandora_agent_daemon"
+- fi
+-
+- if [ $OS_NAME = "HP-UX" ]
+- then
+- 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
+- chmod 755 $PANDORA_STARTUP
+- chown root:0 $PANDORA_STARTUP
+- echo "Pandora FMS agent has been included in /sbin/rcX.d/S90pandora_agent_daemon"
+- fi
+-
+- if [ $OS_NAME = "SunOS" ]
+- then
+- 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
+- chmod 755 $PANDORA_STARTUP
+- chown root:0 $PANDORA_STARTUP
+- echo "Pandora FMS agent has been included in /etc/rc2.d/S90pandora_agent_daemon"
+- fi
+-
+- if [ $OS_NAME = "Linux" ]
+- then
+- PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon
+- cp pandora_agent_daemon $PANDORA_STARTUP
+- if [ -d /etc/rc.d/ ]
++ RCDIRS=""
++ MSG=""
++ if [ "$OS_NAME" = "AIX" ]
+ then
+- 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 2> /dev/null
+- ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent 2> /dev/null
++ RCDIRS=/etc/rc.d/rc2.d
++ MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc.d/rc2.d/S90pandora_agent_daemon"
++ elif [ "$OS_NAME" = "HP-UX" ]
++ then
++ RCDIRS="/sbin/rc2.d /sbin/rc3.d"
++ MSG="Pandora FMS agent has been included in $DESTDIR/sbin/rcX.d/S90pandora_agent_daemon"
++ elif [ "$OS_NAME" = "SunOS" ]
++ then
++ RCDIRS=/etc/rc2.d
++ MSG="Pandora FMS agent has been included in $DESTDIR/etc/rc2.d/S90pandora_agent_daemon"
++ elif [ "$OS_NAME" = "Linux" ]
++ then
++ if [ -d /etc/rc.d/ ]
++ then
++ RCDIRS="/etc/rc.d/rc2.d /etc/rc.d/rc3.d"
++ else
++ RCDIRS="/etc/rc2.d /etc/rc3.d"
++ fi
+ fi
+- chmod 755 $PANDORA_STARTUP
+- chown root:0 $PANDORA_STARTUP
++ [ "$RCDIRS" ] && for RCDIR in $RCDIRS
++ do
++ [ $FAKEROOT -eq 1 ] && [ ! -d $DESTDIR$RCDIR ] && mkdir -p $DESTDIR$RCDIR >/dev/null 2>&1
++ ln -s $PANDORA_STARTUP $DESTDIR$RCDIR/S90pandora_agent 2> /dev/null
++ done
++ [ "$MSG" ] && echo "$MSG"
+ fi
+
+- if [ "$OS_NAME" = "FreeBSD" ]
+- then
+- PANDORA_STARTUP=/usr/local/etc/rc.d/pandora_agent
+- cp FreeBSD/pandora_agent $PANDORA_STARTUP
+- chmod 555 $PANDORA_STARTUP
+- chown root:wheel $PANDORA_STARTUP
+- fi
+-
+- if [ "$OS_NAME" = "NetBSD" ]
+- then
+- PANDORA_STARTUP=/etc/rc.d/pandora_agent
+- cp NetBSD/pandora_agent $PANDORA_STARTUP
+- chmod 555 $PANDORA_STARTUP
+- chown root:wheel $PANDORA_STARTUP
+- fi
+-
+ echo "Done."
+ echo " "
+ echo "You have your startup script ready at $PANDORA_STARTUP"
+Index: plugins/who.sh
+===================================================================
+--- plugins/who.sh (revision 10314)
++++ plugins/who.sh (working copy)
+@@ -1,10 +1,10 @@
+-#!/bin/bash
++#!/bin/sh
+ echo "<module>";
+ echo "<name>who</name>";
+ echo "<type>async_string</type>";
+ echo "<data><![CDATA["
+ WHO=`who`
+-if [ "$WHO" == "" ]; then
++if [ "$WHO" = "" ]; then
+ echo "None"
+ else
+ echo $WHO
+Index: tentacle_server
+===================================================================
+--- tentacle_server (revision 10314)
++++ tentacle_server (working copy)
+@@ -60,9 +60,15 @@
+ use warnings;
+ use Getopt::Std;
+ use IO::Select;
++use threads;
+ use Thread::Semaphore;
+ use POSIX ":sys_wait_h";
++use Time::HiRes qw(usleep);
+
++# Constants for Win32 services.
++use constant WIN32_SERVICE_STOPPED => 0x01;
++use constant WIN32_SERVICE_RUNNING => 0x04;
++
+ my $t_libwrap_installed = eval { require Authen::Libwrap } ? 1 : 0;
+
+ if ($t_libwrap_installed) {
+@@ -77,9 +83,8 @@
+ : eval { require IO::Socket::INET } ? 'IO::Socket::INET'
+ : die $@;
+
+-if ($SOCKET_MODULE eq 'IO::Socket::INET') {
+- print_log ("IO::Socket::INET6 is not found. IPv6 is disabled.");
+-}
++# Service name for Win32.
++my $SERVICE_NAME="Tentacle Server";
+
+ # Program version
+ our $VERSION = '0.4.0';
+@@ -130,7 +135,7 @@
+ my $t_select;
+
+ # Semaphore
+-my $t_sem;
++my $t_sem :shared;
+
+ # Server socket
+ my @t_server_sockets;
+@@ -197,6 +202,7 @@
+ print ("\t-p port\t\tPort to listen on (default $t_port).\n");
+ print ("\t-q\t\tQuiet. Do now print error messages.\n");
+ print ("\t-r number\tNumber of retries for network opertions (default $t_retries).\n");
++ print ("\t-S (install|uninstall|run) Manage the win32 service.\n");
+ print ("\t-t time\t\tTime-out for network operations in seconds (default ${t_timeout}s).\n");
+ print ("\t-v\t\tBe verbose.\n");
+ print ("\t-w\t\tPrompt for OpenSSL private key password.\n");
+@@ -241,27 +247,6 @@
+ }
+
+ ################################################################################
+-## SUB start_win_service
+-## Turn the current process into a Windows service.
+-################################################################################
+-#sub start_win_service {
+-# require Win32::Daemon;
+-#
+-# # Tell the OS to start the service
+-# Win32::Daemon::StartService ();
+-#
+-# # Wait until the service manager is ready
+-# while (SERVICE_START_PENDING != Win32::Daemon::State()) {
+-# sleep (1);
+-# }
+-#
+-# # Tell the service manager we are running
+-# Win32::Daemon::State (SERVICE_RUNNING);
+-#
+-# # Call Win32::Daemon::StopService() when done
+-#}
+-
+-################################################################################
+ ## SUB parse_options
+ ## Parse command line options and initialize global variables.
+ ################################################################################
+@@ -271,7 +256,7 @@
+ my @t_addresses_tmp;
+
+ # Get options
+- if (getopts ('a:c:de:f:hi:k:m:op:qr:s:t:vwx:b:g:T', \%opts) == 0 || defined ($opts{'h'})) {
++ if (getopts ('a:b:c:de:f:g:hi:k:m:op:qr:s:S:t:Tvwx:', \%opts) == 0 || defined ($opts{'h'})) {
+ print_help ();
+ exit 1;
+ }
+@@ -467,19 +452,33 @@
+ error ("Authen::Libwrap is not installed.");
+ }
+ }
+-}
+
+-################################################################################
+-## SUB sigchld_handler
+-## Handle child process termination.
+-################################################################################
+-sub sigchld_handler {
++ # Win32 service management
++ if (defined ($opts{'S'})) {
++ my $service_action = $opts{'S'};
++ if ($^O ne 'MSWin32') {
++ error ("Windows services are only available on Win32.");
++ } else {
++ eval "use Win32::Daemon";
++ die($@) if ($@);
+
+- while (waitpid(-1, &WNOHANG) > 0) {
+- $t_sem->up ();
++ if ($service_action eq 'install') {
++ install_service();
++ } elsif ($service_action eq 'uninstall') {
++ uninstall_service();
++ } elsif ($service_action eq 'run') {
++ Win32::Daemon::RegisterCallbacks({
++ start => \&callback_start,
++ running => \&callback_running,
++ stop => \&callback_stop,
++ });
++ Win32::Daemon::StartService();
++ exit 0;
++ } else {
++ error("Unknown action: $service_action");
++ }
++ }
+ }
+-
+- $SIG{CHLD} = \&sigchld_handler;
+ }
+
+ ################################################################################
+@@ -660,87 +659,86 @@
+ }
+
+ ################################################################################
+-## SUB accept_connection
+-## Accept an incoming connection and fork.
++## SUB accept_connections
++## Manage incoming connections.
+ ################################################################################
+-sub accept_connection {
++sub accept_connections {
+ my $pid;
+ my $t_server_socket;
+
+- my @ready = $select->can_read;
++ # Start server
++ start_server ();
+
+- foreach $t_server_socket (@ready) {
++ # Initialize semaphore
++ $t_sem = Thread::Semaphore->new ($t_max_conn);
+
+- # Accept connection
+- $t_client_socket = $t_server_socket->accept ();
++ while (1) {
++ my @ready = $select->can_read;
++ foreach $t_server_socket (@ready) {
+
+- if (! defined ($t_client_socket)) {
++ # Accept connection
++ $t_client_socket = $t_server_socket->accept ();
+
+- # EINTR
+- if ($! ne '') {
+- next;
++ if (! defined ($t_client_socket)) {
++ next if ($! ne ''); # EINTR
++ error ("accept: $!.");
+ }
+
+- error ("accept: $!.");
+- }
++ print_log ("Client connected from " . $t_client_socket->sockhost ());
+
+- print_log ("Client connected from " . $t_client_socket->sockhost ());
+-
+- # Fork and serve the client
+- $pid = fork ();
+- if (! defined ($pid)) {
+- error ("Cannot fork: $!.");
++ # Create a new thread and serve the client
++ $t_sem->down();
++ my $thr = threads->create(\&serve_client);
++ if (! defined ($thr)) {
++ error ("Error creating thread: $!.");
++ }
++ $thr->detach();
+ }
+-
+- # Child
+- if ($pid == 0) {
+-
+- # We do not need the server socket
+- $t_server_socket->close ();
+
+- if ($t_use_libwrap) {
+- if (! hosts_ctl($t_program_name, $t_client_socket)) {
+- print_log ("Connection from " . $t_client_socket->sockhost() . " is closed by tcpwrappers.");
+- $t_client_socket->close ();
++ usleep (1000);
++ }
++}
+
+- exit;
+- }
+- }
+-
+- # Add client socket to select queue
+- $t_select = IO::Select->new ();
+- $t_select->add ($t_client_socket);
+-
+- # Start SSL
+- if ($t_ssl == 1) {
+- start_ssl ();
+- }
++################################################################################
++## SUB serve_client
++## Serve a connected client.
++################################################################################
++sub serve_client() {
+
+- # Authenticate client
+- if ($t_pwd ne '') {
+- auth_pwd ();
+- }
++ if ($t_use_libwrap) {
++ if (! hosts_ctl($t_program_name, $t_client_socket)) {
++ print_log ("Connection from " . $t_client_socket->sockhost() . " is closed by tcpwrappers.");
++ $t_client_socket->close ();
++ $t_sem->up();
++ return;
++ }
++ }
+
+- # Check if proxy mode is enable
+- if (defined ($t_proxy_ip)) {
+-
+- serve_proxy_connection ();
++ eval {
++ # Add client socket to select queue
++ $t_select = IO::Select->new ();
++ $t_select->add ($t_client_socket);
+
+- } else {
+-
+- serve_connection ();
+- }
+-
+- $t_client_socket->close ();
+-
+- # Must exit now
+- exit;
++ # Start SSL
++ if ($t_ssl == 1) {
++ start_ssl ();
+ }
++
++ # Authenticate client
++ if ($t_pwd ne '') {
++ auth_pwd ();
++ }
++
++ # Check if proxy mode is enable
++ if (defined ($t_proxy_ip)) {
++ serve_proxy_connection ();
++ } else {
++ serve_connection ();
++ }
++ };
+
+- # Parent
+- $t_client_socket->close ();
+-
+- }
++ $t_client_socket->close ();
++ $t_sem->up();
+ }
+
+ ################################################################################
+@@ -1045,10 +1043,8 @@
+ sub error {
+
+ if ($t_quiet == 0) {
+- print (STDERR "[err] $_[0]\n");
++ die("[err] $_[0]\n\n");
+ }
+-
+- exit 1;
+ }
+
+ ################################################################################
+@@ -1414,6 +1410,91 @@
+ }
+
+ ################################################################################
++## SUB install_service
++## Install the Windows service.
++################################################################################
++sub install_service() {
++
++ my $service_path = $0;
++ my $service_params = "-s \"$t_directory\" -S run";
++
++ my %service_hash = (
++ machine => '',
++ name => 'TENTACLESRV',
++ display => $SERVICE_NAME,
++ path => $service_path,
++ user => '',
++ pwd => '',
++ description => 'Tentacle Server http://sourceforge.net/projects/tentacled/',
++ parameters => $service_params
++ );
++
++ if (Win32::Daemon::CreateService(\%service_hash)) {
++ print "Successfully added.\n";
++ exit 0;
++ } else {
++ print "Failed to add service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n";
++ exit 1;
++ }
++}
++
++################################################################################
++## SUB uninstall_service
++## Install the Windows service.
++################################################################################
++sub uninstall_service() {
++ if (Win32::Daemon::DeleteService('', 'TENTACLESRV')) {
++ print "Successfully deleted.\n";
++ exit 0;
++ } else {
++ print "Failed to delete service: " . Win32::FormatMessage(Win32::Daemon::GetLastError()) . "\n";
++ exit 1;
++ }
++}
++
++################################################################################
++## SUB callback_running
++## Windows service callback function for the running event.
++################################################################################
++sub callback_running {
++
++ if (Win32::Daemon::State() == WIN32_SERVICE_RUNNING) {
++ }
++}
++
++################################################################################
++## SUB callback_start
++## Windows service callback function for the start event.
++################################################################################
++sub callback_start {
++
++ # Accept_connections ();
++ my $thr = threads->create(\&accept_connections);
++ if (!defined($thr)) {
++ Win32::Daemon::State(WIN32_SERVICE_STOPPED);
++ Win32::Daemon::StopService();
++ return;
++ }
++ $thr->detach();
++
++ Win32::Daemon::State(WIN32_SERVICE_RUNNING);
++}
++
++################################################################################
++## SUB callback_stop
++## Windows service callback function for the stop event.
++################################################################################
++sub callback_stop {
++
++ foreach my $t_server_socket (@t_server_sockets) {
++ $t_server_socket->close ();
++ }
++
++ Win32::Daemon::State(WIN32_SERVICE_STOPPED);
++ Win32::Daemon::StopService();
++}
++
++################################################################################
+ # Main
+ ################################################################################
+
+@@ -1444,25 +1525,16 @@
+
+ # Handle ctr-c
+ if ($^O eq 'MSWin32') {
++ no warnings;
+ $SIG{INT2} = \&stop_server;
++ use warnings;
+ }
+ else {
+ $SIG{INT} = \&stop_server;
+ }
+
+-# Handle SIGCHLD
+-$SIG{CHLD} = \&sigchld_handler;
+-
+-start_server ();
+-
+-# Initialize semaphore
+-$t_sem = Thread::Semaphore->new ($t_max_conn);
+-
+ # Accept connections
+-while (1) {
+- $t_sem->down ();
+- accept_connection ();
+-}
++accept_connections();
+
+ __END__
+
+Index: pandora_agent_daemon
+===================================================================
+--- pandora_agent_daemon (revision 10314)
++++ pandora_agent_daemon (working copy)
+@@ -34,38 +34,39 @@
+ OS_NAME=`uname -s`
+ if [ $OS_NAME = "HP-UX" ]
+ then
+- PANDORA_PID=`ps -ex | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $1 }'`
+- else
+- if [ "$OS_NAME" = "SunOS" ]
++ PANDORA_PID=`ps -ef | grep "/usr/bin/perl $DAEMON" | grep -v grep | awk '{print $2}'`
++ elif [ "$OS_NAME" = "SunOS" ]
++ then
++ ZONENAME_CMD="/bin/zonename"
++ TRUNCATED_DAEMON=`echo "$DAEMON $PANDORA_PATH" | cut -c1-20`
++ if [ -x $ZONENAME_CMD ]
+ then
+- ZONENAME_CMD="/bin/zonename"
+- TRUNCATED_DAEMON=`echo "$DAEMON $PANDORA_PATH" | cut -c1-20`
+- if [ -x $ZONENAME_CMD ]
+- then
+- ZONE=`$ZONENAME_CMD`
+- else
+- ZONE=
+- fi
+- if [ "$ZONE" = "global" ]
+- then
+- PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'`
+- else
+- PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'`
+- fi
+- elif [ "$OS_NAME" = "Linux" -a -x /usr/sbin/vzpid ]
++ ZONE=`$ZONENAME_CMD`
++ else
++ ZONE=
++ fi
++ if [ "$ZONE" = "global" ]
+ then
+- for _pid in `ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
+- do
+- _ctid=`/usr/sbin/vzpid $_pid | awk '$1 == '$_pid' { print $2 }'`
+- if [ "X$_ctid" = "X0" ]
+- then
+- PANDORA_PID=$_pid
+- break
+- fi
+- done
++ PANDORA_PID=`ps -f -z global | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'`
+ else
+- PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $2 }'`
++ PANDORA_PID=`ps -Af | grep "$TRUNCATED_DAEMON" | grep -v grep | head -1 | awk '{ print $2 }'`
+ fi
++ elif [ "$OS_NAME" = "Linux" ] && [ -x /usr/sbin/vzpid ]
++ then
++ # Virtuozzo/OpenVZ
++ local _pid _ctid _pids
++ _pids=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | awk '{ print $2 }'`
++ [ "$_pids" ] && for _pid in $_pids
++ do
++ _ctid=`/usr/sbin/vzpid $_pid | awk '$1 == '$_pid' { print $2 }'`
++ if [ "X$_ctid" = "X0" ]
++ then
++ PANDORA_PID=$_pid
++ break
++ fi
++ done
++ else
++ PANDORA_PID=`ps -Af | grep "$DAEMON $PANDORA_PATH" | grep -v grep | head -1 | awk '{ print $2 }'`
+ fi
+
+ echo $PANDORA_PID
+Index: pandora_agent
+===================================================================
+--- pandora_agent (revision 10314)
++++ pandora_agent (working copy)
+@@ -343,6 +343,8 @@
+ init_module ($module);
+ } elsif ($line =~ /^\s*module_name\s+(.+)$/) {
+ $module->{'name'} = $1;
++ $module->{'name'} =~ s/\s+$//g;
++ $module->{'name'} =~ s/^\s+//g;
+ } elsif ($line =~ /^\s*module_description\s+(.+)$/) {
+ $module->{'description'} = $1;
+ } elsif ($line =~ /^\s*module_type\s+(\S+)\s*$/) {
+@@ -1727,12 +1729,7 @@
+
+ # Data list
+ if ($#data > 0) {
+- $Xml .= " <datalist>\n";
+- foreach my $data_item (@data) {
+- chomp ($data_item);
+- $Xml .= " <data><value><![CDATA[$data_item]]></value></data>\n";
+- }
+- $Xml .= " </datalist>\n";
++ $Xml .= " <data><![CDATA[" . join('', @data) . "]]></data>\n";
+ # Single data
+ } else {
+ chomp ($data[0]);
+Index: FreeBSD/pandora_agent
+===================================================================
+--- FreeBSD/pandora_agent (revision 10314)
++++ FreeBSD/pandora_agent (working copy)
+@@ -3,6 +3,7 @@
+ # **********************************************************************
+ # Pandora FMS Agent Daemon launcher for FreeBSD
+ # (c) 2010 Junichi Satoh <junichi@rworks.jp>
++# (c) 2014 Koichiro Kikuchi <koichiro@rworks.jp>
+ #
+ # **********************************************************************
+
+@@ -18,7 +19,7 @@
+ . "/etc/rc.subr"
+
+ name="pandora_agent"
+-rcvar=`set_rcvar`
++rcvar=pandora_agent_enable
+
+ # read configuration and set defaults
+ pandora_agent_enable=${pandora_agent_enable:-"NO"}
+@@ -26,22 +27,15 @@
+
+ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
+
+-command=/usr/local/bin/pandora_agent
+-command_args="/usr/local/etc/pandora &"
+-
+ pidfile=/var/run/$name.pid
+ required_files="/usr/local/etc/pandora/pandora_agent.conf"
+-start_postcmd=start_postcmd
+ stop_postcmd=stop_postcmd
+
+-procname="/usr/bin/perl"
++command=/usr/sbin/daemon
++command_interpreter=/usr/local/bin/perl
++procname=/usr/local/bin/pandora_agent
+
+-start_postcmd()
+-{
+- sleep 1
+- PANDORA_PID=`pgrep -f -j none $name`
+- echo $PANDORA_PID > $pidfile
+-}
++command_args="-cfp $pidfile $procname /usr/local/etc/pandora"
+
+ stop_postcmd()
+ {
diff --git a/net-mgmt/pandorafms_agent/pkg-descr b/net-mgmt/pandorafms_agent/pkg-descr
index 47067cf88d27..66fe5a84248b 100644
--- a/net-mgmt/pandorafms_agent/pkg-descr
+++ b/net-mgmt/pandorafms_agent/pkg-descr
@@ -2,4 +2,4 @@ This is the PERL 5.8 version of Pandora FMS agent. This includes all the
advanced features included in 3.0 version, and will be the default agent
in future versions.
-WWW: http://www.pandorafms.org/
+WWW: http://www.pandorafms.com/
diff --git a/net-mgmt/pandorafms_agent/pkg-plist b/net-mgmt/pandorafms_agent/pkg-plist
index cc7797ebe0d8..5b00bd75acf6 100644
--- a/net-mgmt/pandorafms_agent/pkg-plist
+++ b/net-mgmt/pandorafms_agent/pkg-plist
@@ -1,26 +1,37 @@
-@unexec if cmp -s %D/%%ETCDIR%%/pandora_agent.conf.sample %D/%%ETCDIR%%/pandora_agent.conf;then rm -f %D/%%ETCDIR%%/pandora_agent.conf; fi
-%%ETCDIR%%/pandora_agent.conf.sample
-@exec [ -e %D/%F ] || cp -p %D/%F %B/pandora_agent.conf
+@mode 555
bin/pandora_agent
-@exec mkdir -p %D/%%ETCDIR%%/collections
-%%ETCDIR%%/plugins/files_indir
-%%ETCDIR%%/plugins/grep_log
-%%ETCDIR%%/plugins/inventory
-%%ETCDIR%%/plugins/nagios_plugin_wrapper
-%%ETCDIR%%/plugins/pandora_df
-%%ETCDIR%%/plugins/pandora_update
bin/pandora_agent_exec
-bin/tentacle_client
+bin/pandora_revent
%%TENTACLE_SERVER%%bin/tentacle_server
-@exec mkdir -p %D/%%DATADIR%%/collections
+bin/tentacle_client
+etc/rc.d/pandora_agent
+@mode 400
+@owner pandora
+@sample %%ETCDIR%%/pandora_agent.conf.sample
+@owner
+@mode
+man/man1/tentacle_client.1.gz
+man/man1/pandora_agent.1.gz
+@mode 555
%%DATADIR%%/plugins/files_indir
%%DATADIR%%/plugins/grep_log
+%%DATADIR%%/plugins/grep_log_module
%%DATADIR%%/plugins/inventory
%%DATADIR%%/plugins/nagios_plugin_wrapper
%%DATADIR%%/plugins/pandora_df
+%%DATADIR%%/plugins/pandora_df_free
+%%DATADIR%%/plugins/pandora_mem
+%%DATADIR%%/plugins/pandora_netusage
%%DATADIR%%/plugins/pandora_update
+%%DATADIR%%/plugins/top.sh
+%%DATADIR%%/plugins/who.sh
+@owner pandora
+@mode 700
@dirrmtry %%DATADIR%%/collections
@dirrmtry %%DATADIR%%/plugins
+@owner
+@mode
@dirrmtry %%DATADIR%%
-@dirrmtry %%ETCDIR%%/collections
-@dirrmtry %%ETCDIR%%/plugins
+%%ETCDIR%%/plugins
+%%ETCDIR%%/collections
+@dirrmtry %%ETCDIR%%