# (c) 2008 Manuel Arostegui # Please see http://pandora.sourceforge.net # This code is licensed under GPL 2.0 license. # ********************************************************************** #!/bin/bash MODE=$1 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 echo "You are missing the following dependencies" echo " " cat output | awk -F ": prerequisite" '{print $2}' | awk -F " " '{print $1}' echo "The complete installation guide is at: "http://www.openideas.info/wiki/index.php?title=Pandora_1.3:Server:QIG#Installing_from_sources" " echo " " echo "Debian-based distribution do:" echo " $ apt-get install libdate-manip-perl snmp snmpd libsnmp-perl libtime-format-perl libxml-simple-perl libnetaddr-ip-perl libdbi-perl libxml-simple-perl libnetaddr-ip-perl" echo " " echo "RedHat-based distribution do" echo " " echo " $ yum perl-XML-SAX* perl-Tie* perl-XML-Simple* perl-DateManip* perl-IO-Socket* perl-Time-modules* perl-NetAddr-IP* perl-GD* perl-DateTime* perl-ExtUtils" echo " " echo " $ cpan install Digest::MD5 Time::Local DBI threads threads::shared IO::Socket Time::HiRes Time::Format Net::Ping NetAddr::IP " rm output else make make install mkdir /var/spool/pandora mkdir /var/spool/pandora/data_in useradd pandora mkdir /home/pandora mkdir /home/pandora/.ssh chown -R pandora /home/pandora mkdir /var/log/pandora chown pandora:root /var/spool/pandora/data_in chmod 770 /var/spool/pandora/data_in mkdir /etc/pandora cp conf/pandora_server.conf /etc/pandora/ chmod 770 /etc/pandora/pandora_server.conf cp pandora_* /etc/init.d/ rm /etc/init.d/pandora_server_installer ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server ln -s /etc/init.d/pandora_recon /etc/rc2.d/S90pandora_recon ln -s /etc/init.d/pandora_network /etc/rc2.d/S90pandora_network ln -s /etc/init.d/pandora_snmpconsole /etc/rc2.d/S90pandora_snmpconsole ln -s /usr/local/bin/pandora_server /usr/bin/pandora_server ln -s /usr/local/bin/pandora_snmpconsole /usr/bin/pandora_snmpconsole ln -s /usr/local/bin/pandora_recon /usr/bin/pandora_recon ln -s /usr/local/bin/pandora_network /usr/bin/pandora_network ln -s /usr/local/bin/pandora_prediction /usr/bin/pandora_prediction ln -s /usr/local/bin/pandora_plugin /usr/bin/pandora_plugin ln -s /usr/local/bin/pandora_export /usr/bin/pandora_export mkdir /usr/share/pandora cp -R util /usr/share/pandora cp -R plugin /usr/share/pandora echo "perl /usr/share/pandora/util/pandora_db /etc/pandora/pandora_server.conf" > /etc/cron.daily/pandora_purge_db chmod +x /etc/cron.daily/pandora_purge_db rm output fi } uninstall () { echo "Removing Pandora Servers" rm -Rf /var/spool/pandora/data_in/ rm -Rf /home/pandora/ userdel pandora rm -Rf /var/log/pandora/ rm -Rf /etc/pandora/pandora_server.conf rm -Rf /etc/init.d/pandora_server rm -Rf /etc/init.d/pandora_network rm -Rf /etc/init.d/pandora_recon rm -Rf /etc/init.d/pandora_snmpconsole rm -Rf /etc/rc2.d/S90pandora_server rm -Rf /etc/rc2.d/S90pandora_recon rm -Rf /etc/rc2.d/S90pandora_network rm -Rf /etc/rc2.d/S90pandora_snmpconsole rm -Rf /usr/local/bin/pandora_server rm -Rf /usr/local/bin/pandora_snmpconsole rm -Rf /usr/local/bin/pandora_recon rm -Rf /usr/local/bin/pandora_network rm -Rf /usr/bin/pandora_server rm -Rf /usr/bin/pandora_snmpconsole rm -Rf /usr/bin/pandora_recon rm -Rf /usr/bin/pandora_network rm -Rf /usr/bin/pandora_prediction 2> /dev/null rm -Rf /usr/bin/pandora_plugin 2> /dev/null rm -Rf /usr/bin/pandora_export 2> /dev/null rm -Rf /usr/share/pandora rm -Rf /etc/cron.daily/pandora_purge_db echo "Done" } help () { echo " --install To install Pandora FMS Servers on this system (You have to be root)" echo " --uninstall To uninstall and remove Pandora FMS Servers on this System" echo " " } # Script banner at start echo " " echo "Pandora FMS 2.0 Server Installer (c) 2008 Manuel Arostegui" echo "This program is licensed under GPL2 Terms. http://pandora.sourceforge.net" echo " " case "$MODE" in '--install') install exit ;; '--uninstall') uninstall exit ;; *) help esac