2009-12-03 Miguel de Dios <miguel.dedios@artica.es>

* DEBIAN/control, DEBIAN/md5sums, DEBIAN/postinst, DEBIAN/prerm,
	DEBIAN/conffiles: debian base files for to make a .deb package.
	* make_deb_package.sh: shell script for make automatically the deb package
	for standard installation in a Debian Lenny, this script make a package
	"pandorafms.server_3.0.0.rc1.deb" and the other necesary packages (perl).



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2072 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-11-03 17:18:52 +00:00
parent cefabcc7ac
commit a972b511c7
7 changed files with 349 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2009-12-03 Miguel de Dios <miguel.dedios@artica.es>
* DEBIAN/control, DEBIAN/md5sums, DEBIAN/postinst, DEBIAN/prerm,
DEBIAN/conffiles: debian base files for to make a .deb package.
* make_deb_package.sh: shell script for make automatically the deb package
for standard installation in a Debian Lenny, this script make a package
"pandorafms.server_3.0.0.rc1.deb" and the other necesary packages (perl).
2009-11-01 Ramon Novoa <rnovoa@artica.es>
* util/pandora_db.pl: Date::Manip is not used anymore.

View File

@ -0,0 +1 @@
/etc/pandora/pandora_server.conf

View File

@ -0,0 +1,10 @@
package: PandoraFMS-Server
Version: 3.0.0.rc1
Architecture: all
Priority: optional
Section: admin
Installed-Size: 640
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
Homepage: http://pandorafms.org/
Depends: perl (>= 5.8), libmail-sendmail-perl, libdbi-perl, libdbd-mysql-perl,libtime-format-perl, libnetaddr-ip-perl, libdate-manip-perl, libtime-format-perl, libxml-simple-perl, libnetaddr-ip-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo, logrotate
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.

View File

119
pandora_server/DEBIAN/postinst Executable file
View File

@ -0,0 +1,119 @@
#!/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"
}
echo "Giving proper permission to /var/spool/pandora"
id -g www-data > /dev/null
if [ $? -eq 0 ]
then
chown -R pandora:www-data /var/spool/pandora/
else
id -g www > /dev/null
if [ $? -eq 0 ]
then
chown -R pandora:www /var/spool/pandora/
else
id -g apache > /dev/null
if [ $? -eq 0 ]
then
chown -R pandora:apache /var/spool/pandora/
else
echo "No web server user found, some functionality might not perform correctly"
chown -R pandora:root /var/spool/pandora
fi
fi
fi
chmod 770 /etc/pandora/pandora_server.conf
GET_DISTRO="`get_distro`"
DISTRO=`echo $GET_DISTRO | cut -f 1 -d ":"`
if [ "$DISTRO" == "UBUNTU" ]
then
echo "Linking startup script to /etc/rc2.d"
ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server
else
INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"`
echo "Linking startup script to /etc/rc.d/rc$INITLV.d"
ln -s /etc/init.d/pandora_server /etc/rc.d/rc$INITLV.d/S90pandora_server
fi
if [ "$DISTRO" == "UBUNTU" ]
then
# Tentacle server install (Ubuntu)
echo "Installing tentacle server in /etc/rc2.d/S80tentacle_serverd"
ln -s /etc/init.d/tentacle_serverd /etc/rc2.d/S80tentacle_serverd
else
# Tentacle server install (SUSE)
echo "Installing tentacle server in /etc/rc.d/rc$INITLV.d/S80tentacle_serverd"
ln -s /etc/init.d/tentacle_serverd /etc/rc.d/rc$INITLV.d/S80tentacle_serverd
fi
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 ."

76
pandora_server/DEBIAN/prerm Executable file
View File

@ -0,0 +1,76 @@
#!/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 ":"`
if [ "$DISTRO" == "UBUNTU" ]
then
rm /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server
rm /etc/init.d/tentacle_serverd /etc/rc2.d/S80tentacle_serverd
else
INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"`
rm /etc/init.d/pandora_server /etc/rc.d/rc$INITLV.d/S90pandora_server
rm /etc/init.d/tentacle_serverd /etc/rc.d/rc$INITLV.d/S80tentacle_serverd
fi
if [ -d /etc/cron.daily ]
then
rm /etc/cron.daily/pandora_db
fi

View File

@ -0,0 +1,136 @@
#!/bin/bash
#Pandora FMS- http:#pandorafms.com
# ==================================================
# Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
# Please see http:#pandorafms.org for full contribution list
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; version 2
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_console_version="3.0.0.rc1"
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 ]
then
echo "You aren't root."
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
echo Make a \"temp_package\" temp dir for job.
mkdir temp_package
echo Make the fake tree system in \"temp_package\".
mkdir temp_package/var
mkdir temp_package/var/spool
mkdir temp_package/var/spool/pandora
mkdir temp_package/var/spool/pandora/data_in
mkdir temp_package/var/spool/pandora/data_in/conf
mkdir temp_package/var/spool/pandora/data_in/md5
mkdir temp_package/var/log
mkdir temp_package/var/log/pandora
mkdir temp_package/etc
mkdir temp_package/etc/pandora
mkdir temp_package/etc/init.d/
mkdir temp_package/etc/logrotate.d
mkdir temp_package/usr
mkdir temp_package/usr/share
mkdir temp_package/usr/share/pandora_server
mkdir temp_package/usr/local
mkdir temp_package/usr/local/bin
echo Make the perl of Pandora Server.
perl Makefile.PL
make
cat Makefile | sed -e "s/PREFIX = \/usr/PREFIX = temp_package\/usr/" > Makefile.temp
mv Makefile.temp Makefile
rm Makefile.temp
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/local/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.
for item in `find temp_package`
do
echo -n "."
echo $item | grep "svn" > /dev/null
#last command success
if [ $? -eq 0 ]
then
rm -rf $item
fi
done
echo ""
echo Calcule md5sum for md5sums file control of package
for item in `find temp_package`
do
echo -n "."
if [ ! -d $item ]
then
echo $item | grep "DEBIAN" > /dev/null
#last command success
if [ $? -eq 1 ]
then
md5=`md5sum $item | cut -d" " -f1`
#delete "temp_package" in the path
final_path=${item#temp_package}
echo $md5" "$final_path >> temp_package/DEBIAN/md5sums
fi
fi
done
exit
echo ""
echo "Make the package \"Pandorafms server\"."
dpkg-deb --build temp_package
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 -rf temp_package