--- pandora_server_installer.orig	2011-09-24 00:16:47.000000000 +0900
+++ pandora_server_installer	2011-12-07 13:57:23.238651664 +0900
@@ -83,7 +83,6 @@ get_distro () {
 
 install () {
 
-	perl Makefile.PL > output 2>&1 #&& sleep 2 && cat output | grep "found" | wc -l 
 	DEPENDENCIAS=`cat output | grep "found" | wc -l`
 	if [ $DEPENDENCIAS -gt 0 ]
 	then
@@ -143,10 +142,10 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 		elif [ "$DISTRO" = "FreeBSD" ]
                 then
 			echo "FreeBSD detected"
-			PANDORA_SPOOL=/var/spool/pandora
-			PANDORA_HOME=/usr/local/share/pandora_server
-			PANDORA_CFG_DIR=/usr/local/etc/pandora
-			PANDORA_LOG=/var/log/pandora
+			PANDORA_SPOOL=%%PANDORA_SPOOLDIR%%
+			PANDORA_HOME=%%DATADIR%%
+			PANDORA_CFG_DIR=%%PANDORA_ETCDIR%%
+			PANDORA_LOG=%%PANDORA_LOGDIR%%
 			PANDORA_SERVER=/usr/local/etc/rc.d/pandora_server
 			TENTACLE_SERVER=/usr/local/etc/rc.d/tentacle_server
 			PANDORA_CFG_FILE=/usr/local/etc/pandora/pandora_server.conf
@@ -159,7 +158,7 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 	    echo "Checking binaries at /usr/local/bin -> /usr/bin"
 		if [ ! -e "/usr/bin/pandora_server" ]
 		then
-			if [ ! -e "/usr/local/bin/pandora_server" ]
+			if [ ! -e "%%PREFIX%%/bin/pandora_server" ]
 			then
 				echo "ERROR compiling Pandora FMS Server from sources. Aborting"
 				exit 1
@@ -182,7 +181,7 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 			if [ "$AREYOUSURE" = "y" ]; then
 				if [ "$DISTRO" = "FreeBSD" ]
 				then
-					echo "pandora:41121:::::Pandora FMS:/home/pandora:/usr/sbin/nologin:" | adduser -f - -w no 2> /dev/null
+					:
 				else
 					useradd pandora 
 					mkdir /home/pandora 2> /dev/null
@@ -238,16 +237,10 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 		
 		echo "Creating setup directory in $PANDORA_CFG_DIR"
 		mkdir $PANDORA_CFG_DIR 2> /dev/null
-		if [ -e $PANDORA_CFG_FILE ]
-		then
-			OLDFILENAMETMP=`date +"%Y-%m-%d"`
-			echo "Old installation detected, backing up pandora_server.conf.$ODFILENAMETMP"
-			mv $PANDORA_CFG_FILE $PANDORA_CFG_FILE.$OLDFILENAMETMP
-		fi
 		if [ "$DISTRO" = "FreeBSD" ]
 		then
 			echo cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR
-                	cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR
+                	cp FreeBSD/pandora_server.conf $PANDORA_CFG_DIR/pandora_server.conf.sample
 		else
 			echo cp conf/pandora_server.conf $PANDORA_CFG_DIR
 			cp conf/pandora_server.conf $PANDORA_CFG_DIR
@@ -257,7 +250,7 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 		echo "Installing Pandora Server manual"
 		if [ "$DISTRO" = "FreeBSD" ]
 		then
-			cp man/man1/pandora_server.1.gz /usr/local/man/man1
+			zcat man/man1/pandora_server.1.gz > %%MAN1PREFIX%%/man/man1/pandora_server.1
 		else
 			cp man/man1/pandora_server.1.gz /usr/share/man/man1
 		fi
@@ -288,22 +281,9 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 					ln -s $PANDORA_SERVER /etc/rc.d/rc$INITLV.d/S90pandora_server
 				fi
 			fi
-		else
-			if [ "$DISTRO" = "FreeBSD" ]
-			then
-				echo "Copying the daemon script into $PANDORA_SERVER"
-				cp FreeBSD/pandora_server $PANDORA_SERVER 
-				chmod 555 $PANDORA_SERVER
-                        fi
 		fi
 
-		if [ -d /etc/logrotate.d ]; then
-			echo "Creating logrotate.d entry for Pandora FMS log management"
-			cp util/pandora_logrotate /etc/logrotate.d/pandora
-		else
 			echo "Please add a log rotation schedule manually to your log rotation daemon (if any)"
-		fi
-	
 		if [ "$LINUX" = "YES" ]
 		then
 			if [ "$SECOPT" != "--no-tentacle" ]
@@ -343,12 +323,10 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 				if [ "$DISTRO" = "FreeBSD" ]
 				then
 					echo "Installing tentacle server"
-					cp bin/tentacle_server /usr/local/bin
-					chown pandora /usr/local/bin/tentacle_server
-					cp FreeBSD/tentacle_server $TENTACLE_SERVER
-					chmod 555 $TENTACLE_SERVER
+					cp bin/tentacle_server %%PREFIX%%/bin
+					chown pandora %%PREFIX%%/bin/tentacle_server
 					echo "Installing Tentacle Server manual"
-					cp man/man1/tentacle_server.1.gz /usr/local/man/man1
+					zcat man/man1/tentacle_server.1.gz > %%MAN1PREFIX%%/man/man1/tentacle_server.1
 				fi
 			fi
 		fi
@@ -357,39 +335,11 @@ perl-TimeDate perl-XML-Simple perl-XML-T
 		mkdir $PANDORA_HOME 2> /dev/null
 		cp -R util $PANDORA_HOME
 		
-		if [ -d /etc/cron.daily ]
-		then
-			echo "Creating the Cron script to run daily Pandora DB tool"
-			echo "#!/bin/bash" > /etc/cron.daily/pandora_db	
-			echo "perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf" >> /etc/cron.daily/pandora_db	
-			chmod +x /etc/cron.daily/pandora_db
-		else
-			if [ "$DISTRO" = "FreeBSD" ]
-			then
-				grep pandora_db.pl /etc/crontab > /dev/null 2>&1
-				if [ $? -ne 0 ]
-				then
-					echo "# Pandora FMS" >> /etc/crontab
-					echo "2 0       *       *       *       root    perl /usr/local/share/pandora_server/util/pandora_db.pl /usr/local/etc/pandora/pandora_server.conf" >> /etc/crontab
-				else
-					echo "The crontab for pandora_db.pl is already configured."
-				fi
-			else
-				echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (daily) on your master server:"
-				echo "	perl /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf"
-			fi
-		fi
 		echo
 		echo "Now you have to edit your $PANDORA_CFG_FILE file to change the database password (default is pandora) with the one set in include/config.php of your Pandora FMS Console."
 		echo "After setting password you can start your Pandora FMS Server!!"
 		rm output
 
-		if [ -d "/etc/logrotate.d" ]
-		then
-			echo "Managing Pandora FMS logs with logrotate (Distro independent)"
-			cp -aRf util/pandora_logrotate /etc/logrotate.d/pandora
-		fi
-
 		if [ "$DISTRO" = "FreeBSD" ]
 		then
 			echo " "
