From 16c7ebca5ae87bec54aaeee7b0771eb47d7ce14f Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 14 Jan 2010 09:02:49 +0000 Subject: [PATCH] 2010-01-14 Miguel de Dios * DEBIAN/* : restore previus version, I had mistake with this directory in Eclipse aplication between Enterprise and Open. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2270 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 + pandora_server/DEBIAN/control | 6 +- pandora_server/DEBIAN/make_deb_package.sh | 59 +++++++++++---- pandora_server/DEBIAN/md5sums | 1 - pandora_server/DEBIAN/postinst | 91 ++++++++++++++++++++++- pandora_server/DEBIAN/prerm | 70 +++++++++++++++++ 6 files changed, 212 insertions(+), 19 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 5ddab07972..ee2c3feaf8 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2010-01-14 Miguel de Dios + * DEBIAN/* : restore previus version, I had mistake with this directory in + Eclipse aplication between Enterprise and Open. + 2010-01-12 Pablo de la ConcepciĆ³n * lib/PandoraFMS/Core.pm: Fixed a bug introduced in last commmit diff --git a/pandora_server/DEBIAN/control b/pandora_server/DEBIAN/control index b0de5a8781..fe8d438fa1 100644 --- a/pandora_server/DEBIAN/control +++ b/pandora_server/DEBIAN/control @@ -1,4 +1,4 @@ -package: PandoraFMS-Server-Enterprise +package: PandoraFMS-Server Version: 3.0.0 Architecture: all Priority: optional @@ -6,5 +6,5 @@ Section: admin Installed-Size: 640 Maintainer: Miguel de Dios Homepage: http://pandorafms.org/ -Depends: pandorafms-server, libio-socket-multicast-perl -Description: Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. \ No newline at end of file +Depends: perl (>= 5.8), libmail-sendmail-perl, libdbi-perl, libdbd-mysql-perl,libtime-format-perl, libnetaddr-ip-perl, libtime-format-perl, libxml-simple-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo +Description: Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. This is the server package. Server makes the remote checks and process information transfer by Pandora FMS agents to the server. diff --git a/pandora_server/DEBIAN/make_deb_package.sh b/pandora_server/DEBIAN/make_deb_package.sh index 2dabb3d71a..3dc0c2d452 100644 --- a/pandora_server/DEBIAN/make_deb_package.sh +++ b/pandora_server/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_server_version="3.0.0" +pandora_console_version="3.0.0" echo "This script to make deb must run as root (because the dh-make-perl need this). Then test if you are root." if [ `id -u` != 0 ] @@ -23,11 +23,31 @@ then exit 1 fi +echo "Test if you has the tools for to make the packages." +whereis dh-make-perl | cut -d":" -f2 | grep dh-make-perl > /dev/null +if [ $? = 1 ] +then + echo "No found \"dh-make-perl\" aplication, please install." + exit 1 +else + echo "Found \"dh-make-perl\"." +fi + cd .. echo "Make a \"temp_package\" temp dir for job." mkdir temp_package +echo "Make the fake tree system in \"temp_package\"." +mkdir -p temp_package/var/spool/pandora/data_in/conf +mkdir -p temp_package/var/spool/pandora/data_in/md5 +mkdir -p temp_package/var/log/pandora +mkdir -p temp_package/etc/pandora +mkdir -p temp_package/etc/init.d/ +mkdir -p temp_package/etc/logrotate.d +mkdir -p temp_package/usr/share/pandora_server +mkdir -p temp_package/usr/bin + echo "Make the perl of Pandora Server." perl Makefile.PL make @@ -45,10 +65,18 @@ cat Makefile.temp | sed -e "s/INSTALLSITESCRIPT = .*/INSTALLSITESCRIPT = temp_pa cat Makefile | sed -e "s/INSTALLVENDORSCRIPT = .*/INSTALLVENDORSCRIPT = temp_package\/usr\/bin/" > Makefile.temp mv Makefile.temp Makefile - make install echo "Copy other files in fake file." +cp util/pandora_logrotate temp_package/etc/logrotate.d/pandora + +cp bin/tentacle_server temp_package/usr/bin +cp util/tentacle_serverd temp_package/etc/init.d/tentacle_serverd + +cp conf/pandora_server.conf temp_package/etc/pandora/ +cp util/pandora_server temp_package/etc/init.d/ + +cp -R util temp_package/usr/share/pandora_server cp -R DEBIAN temp_package/ echo "Remove the SVN files and other temp files." @@ -62,12 +90,6 @@ do rm -rf $item fi - echo $item | grep "perllocal.pod" > /dev/null - if [ $? -eq 0 ] - then - rm -rf $item - fi - echo $item | grep "make_deb_package.sh" > /dev/null #last command success if [ $? -eq 0 ] @@ -100,11 +122,22 @@ echo "END" echo "Make the package \"Pandorafms server\"." dpkg-deb --build temp_package -mv temp_package.deb pandorafms.server_enterprise_$pandora_server_version.deb -chmod 777 pandorafms.server_enterprise_$pandora_server_version.deb +mv temp_package.deb pandorafms.server_$pandora_console_version.deb +chmod 777 pandorafms.server_$pandora_console_version.deb + +echo "Make the package \"libnet-traceroute-pureperl-perl\"." +cd temp_package +dh-make-perl --build --cpan Net::Traceroute::PurePerl +chmod 777 libnet-traceroute-pureperl-perl*.deb +mv libnet-traceroute-pureperl-perl*.deb .. +cd .. + +echo "Make the package \"libnet-traceroute-perl\"." +cd temp_package +dh-make-perl --build --cpan Net::Traceroute +chmod 777 libnet-traceroute-perl*.deb +mv libnet-traceroute-perl*.deb .. +cd .. echo "Delete the \"temp_package\" temp dir for job." -rm Makefile -rm -rf blib -rm pm_to_blib rm -rf temp_package diff --git a/pandora_server/DEBIAN/md5sums b/pandora_server/DEBIAN/md5sums index 8b13789179..e69de29bb2 100644 --- a/pandora_server/DEBIAN/md5sums +++ b/pandora_server/DEBIAN/md5sums @@ -1 +0,0 @@ - diff --git a/pandora_server/DEBIAN/postinst b/pandora_server/DEBIAN/postinst index c6d4060de0..24cfcd84ac 100755 --- a/pandora_server/DEBIAN/postinst +++ b/pandora_server/DEBIAN/postinst @@ -1,4 +1,91 @@ #!/bin/bash -echo "NOTICE: You will need to edit your pandora_server.conf file to enable Enterprise features and restart Pandora FMS server after that." -echo "Please note that you must enter in Pandora FMS Enteprise console PRIOR to execute Pandora FMS Enterprise server" \ No newline at end of file +get_distro () { + # Get Linux Distro type and version + # We assume we are on Linux unless told otherwise + LINUX=YES + if [ -f "/etc/SuSE-release" ] + then + OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` + LINUX_DISTRO=SUSE + elif [ -f "/etc/lsb-release" ] + then + OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="` + LINUX_DISTRO=UBUNTU + OS_VERSION="UBUNTU $OS_VERSION" + elif [ -f "/etc/debian_version" ] + then + OS_VERSION=`cat /etc/debian_version` + OS_VERSION="DEBIAN $OS_VERSION" + LINUX_DISTRO=DEBIAN + elif [ -f "/etc/fedora-release" ] + then + OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` + OS_VERSION="FEDORA $OS_VERSION" + LINUX_DISTRO=FEDORA + elif [ `uname -s` == "Darwin" ] + then + # For future reference, Darwin doesn't have /etc/init.d but uses LaunchDaemons + LINUX_DISTRO="Darwin" + OS_VERSION=`uname -r` + LINUX=NO + elif [ `uname -s` == "AIX" ] + then + # For future reference, AIX doesn't have /etc/init.d + LINUX_DISTRO="AIX" + OS_VERSION=`uname -r` + LINUX=NO + elif [ `uname -s` == "SunOS" ] + then + # Some Solaris and other Unices don't have /etc/init.d, some have /usr/spool instead of /var/spool + LINUX_DISTRO="Solaris" + OS_VERSION=`uname -r` + LINUX=NO + elif [ `uname -s` == "Linux" ] + then + # Test for Linux to make sure we're on Linux + LINUX_DISTRO="GENERIC" + OS_VERSION=`uname -r` + else + # Default to Linux is false, test for real Linux above - that way we don't assume we can just plunk down files everywhere + LINUX_DISTRO=`uname -s` + OS_VERSION=`uname -r` + LINUX=NO + fi + echo "$LINUX_DISTRO:$OS_VERSION:$LINUX" +} + + +echo "Creating common Pandora FMS directories" +useradd pandora 2> /dev/null +mkdir -p /home/pandora/.ssh 2> /dev/null +chown -R pandora:root /home/pandora +chmod 755 /usr/bin/tentacle_server + +echo "Giving proper permission to /var/spool/pandora" +chown -R pandora /var/spool/pandora/ + +echo "Creating setup directory in /etc/pandora" +mkdir /etc/pandora 2> /dev/null + +chmod 770 /etc/pandora/pandora_server.conf + +echo "Linking startup script to /etc/rc2.d" +update-rc.d pandora_server defaults + +# Tentacle server install +echo "Installing tentacle server in /etc/rc2.d/S80tentacle_serverd" +update-rc.d tentacle_serverd defaults + +if [ -d /etc/cron.daily ] +then + echo "Create 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 750 /etc/cron.daily/pandora_db +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 + +echo "Please, now, edit the /etc/pandora/pandora_server.conf and launch the Pandora Server with /etc/init.d/Pandora ." diff --git a/pandora_server/DEBIAN/prerm b/pandora_server/DEBIAN/prerm index 05a7907cf5..e1d662a682 100755 --- a/pandora_server/DEBIAN/prerm +++ b/pandora_server/DEBIAN/prerm @@ -1,2 +1,72 @@ #!/bin/bash +get_distro () { + # Get Linux Distro type and version + # We assume we are on Linux unless told otherwise + LINUX=YES + if [ -f "/etc/SuSE-release" ] + then + OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` + LINUX_DISTRO=SUSE + elif [ -f "/etc/lsb-release" ] + then + OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="` + LINUX_DISTRO=UBUNTU + OS_VERSION="UBUNTU $OS_VERSION" + elif [ -f "/etc/debian_version" ] + then + OS_VERSION=`cat /etc/debian_version` + OS_VERSION="DEBIAN $OS_VERSION" + LINUX_DISTRO=DEBIAN + elif [ -f "/etc/fedora-release" ] + then + OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "` + OS_VERSION="FEDORA $OS_VERSION" + LINUX_DISTRO=FEDORA + elif [ `uname -s` == "Darwin" ] + then + # For future reference, Darwin doesn't have /etc/init.d but uses LaunchDaemons + LINUX_DISTRO="Darwin" + OS_VERSION=`uname -r` + LINUX=NO + elif [ `uname -s` == "AIX" ] + then + # For future reference, AIX doesn't have /etc/init.d + LINUX_DISTRO="AIX" + OS_VERSION=`uname -r` + LINUX=NO + elif [ `uname -s` == "SunOS" ] + then + # Some Solaris and other Unices don't have /etc/init.d, some have /usr/spool instead of /var/spool + LINUX_DISTRO="Solaris" + OS_VERSION=`uname -r` + LINUX=NO + elif [ `uname -s` == "Linux" ] + then + # Test for Linux to make sure we're on Linux + LINUX_DISTRO="GENERIC" + OS_VERSION=`uname -r` + else + # Default to Linux is false, test for real Linux above - that way we don't assume we can just plunk down files everywhere + LINUX_DISTRO=`uname -s` + OS_VERSION=`uname -r` + LINUX=NO + fi + echo "$LINUX_DISTRO:$OS_VERSION:$LINUX" +} + +rm /etc/pandora/pandora_server.conf + +GET_DISTRO="`get_distro`" +DISTRO=`echo $GET_DISTRO | cut -f 1 -d ":"` + +rm /etc/init.d/pandora_server +rm /etc/init.d/tentacle_serverd +update-rc.d pandora_server remove +update-rc.d tentacle_serverd remove + +if [ -d /etc/cron.daily ] +then + rm /etc/cron.daily/pandora_db +fi +