Modified server tarball to permit enterprise installer call (from-binary option)

This commit is contained in:
fermin831 2016-01-13 16:04:36 +01:00
parent 1242db08f8
commit 671b40f5bf
1 changed files with 75 additions and 68 deletions

143
pandora_server/pandora_server_installer Normal file → Executable file
View File

@ -45,7 +45,7 @@ set_global_vars () {
OS_VERSION=`uname -r` OS_VERSION=`uname -r`
DISTRO=`uname -s` DISTRO=`uname -s`
# set corret value for LINUX_DISTRO # set correct value for LINUX_DISTRO
case $DISTRO in case $DISTRO in
Linux) Linux)
# Default for Linux # Default for Linux
@ -168,92 +168,98 @@ install () {
set_global_vars set_global_vars
FORCE=0 FORCE=0
BINARIES=0
# parse options # parse options
while : while :
do do
case $1 in case $1 in
--force) FORCE=1;; --force) FORCE=1;;
--no-tentacle) WITHOUT_TENTALCE=1;; --from-binary) BINARIES=1;;
--no-tentacle) WITHOUT_TENTACLE=1;;
--destdir) DESTDIR=$2;shift;; --destdir) DESTDIR=$2;shift;;
*) break;; *) break;;
esac esac
shift shift
done done
$PERL Makefile.PL INSTALLMAN1DIR=none WITHOUT_TENTACLE=$WITHOUT_TENTACLE > output 2>&1
#&& sleep 2 && cat output | grep "found" | wc -l
DEPENDENCIAS=`cat output | grep "found" | wc -l`
if [ $DEPENDENCIAS -gt 0 ] && [ $FORCE -eq 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://openideas.info/wiki/index.php?title=Pandora"
echo " "
echo "Debian-based distribution do:"
echo " # apt-get install snmp snmpd libjson-perllibio-socket-inet6-perl libsocket6-perl libxml-simple-perl libxml-twig-perl libnetaddr-ip-perl libdbi-perl libnetaddr-ip-perl libhtml-parser-perl wmi-client xprobe2 snmp-mibs-downloader"
echo " "
echo "For CentOS / RHEL do: "
echo " "
echo " # yum install perl-XML-Simple* perl-XML-Twig perl-JSON perl-IO-Socket* perl-Socket6 perl-Time-modules* perl-NetAddr-IP* perl-DateTime* perl-ExtUtils perl-DBI nmap "
echo " "
echo "For OpenSUSE / SLES do : "
echo " "
echo " # zypper install nmap perl-DBD-mysql perl-DBI perl-HTML-Parser perl-JSON
perl-HTML-Encoding perl-HTML-Tree perl-NetAddr-IP perl-IO-Socket-INET6 perl-Socket6
perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client"
echo " "
echo " You also will need to install (optionally) xprobe2 and wmiclient from rpm (download from our website)"
echo " "
echo "For FreeBSD do : "
echo " "
echo " Install perl5.8 or later from ports with thread enabled."
echo " (perl-5.8.x.pkg can not be used.)"
echo " # cd /usr/ports/lang/perl5.8"
echo " # make config"
echo " -> Enable THREADS."
echo " # make"
echo " # make install"
echo " "
echo " Install following tools from ports. Don't use packages."
echo " Recommended: p5-DBI p5-NetAddr-IP p5-XML-Simple p5-XML-Twig p5-HTML-Parser p5-DBD-mysql p5-Socket6 p5-IO-Socket-INET6 p5-JSON"
echo " Optional: nmap xprobe"
echo " "
echo "To get it from source through CPAN do"
echo " "
echo " $ cpan Time::Local DBI Socket6 XML::Simple XML::Twig IO::Socket Time::HiRes NetAddr::IP HTML::Entities IO::Socket::INET6 JSON"
echo " "
rm output
exit 1
fi
rm output
if [ "$LINUX" = YES ] if [ "$LINUX" = YES ]
then then
echo "$DISTRO distribution detected" echo "$DISTRO distribution detected"
else else
echo "$DISTRO detected" echo "$DISTRO detected"
fi fi
echo "Installing binaries and libraries" if [ ! $BINARIES -eq 1 ]
make # Do not compile files if binary is distributed
make DESTDIR=$DESTDIR install
echo "Checking binaries at /usr/local/bin -> /usr/bin"
if [ ! -f "$DESTDIR/usr/bin/pandora_server" ]
then then
if [ ! -f "$DESTDIR/usr/local/bin/pandora_server" ] $PERL Makefile.PL INSTALLMAN1DIR=none WITHOUT_TENTACLE=$WITHOUT_TENTACLE > output 2>&1
#&& sleep 2 && cat output | grep "found" | wc -l
DEPENDENCIAS=`cat output | grep "found" | wc -l`
if [ $DEPENDENCIAS -gt 0 ] && [ $FORCE -eq 0 ]
then then
echo "ERROR compiling Pandora FMS Server from sources. Aborting" 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://openideas.info/wiki/index.php?title=Pandora"
echo " "
echo "Debian-based distribution do:"
echo " # apt-get install snmp snmpd libjson-perllibio-socket-inet6-perl libsocket6-perl libxml-simple-perl libxml-twig-perl libnetaddr-ip-perl libdbi-perl libnetaddr-ip-perl libhtml-parser-perl wmi-client xprobe2 snmp-mibs-downloader"
echo " "
echo "For CentOS / RHEL do: "
echo " "
echo " # yum install perl-XML-Simple* perl-XML-Twig perl-JSON perl-IO-Socket* perl-Socket6 perl-Time-modules* perl-NetAddr-IP* perl-DateTime* perl-ExtUtils perl-DBI nmap "
echo " "
echo "For OpenSUSE / SLES do : "
echo " "
echo " # zypper install nmap perl-DBD-mysql perl-DBI perl-HTML-Parser perl-JSON
perl-HTML-Encoding perl-HTML-Tree perl-NetAddr-IP perl-IO-Socket-INET6 perl-Socket6
perl-TimeDate perl-XML-Simple perl-XML-Twig perl-libwww-perl mysql-client"
echo " "
echo " You also will need to install (optionally) xprobe2 and wmiclient from rpm (download from our website)"
echo " "
echo "For FreeBSD do : "
echo " "
echo " Install perl5.8 or later from ports with thread enabled."
echo " (perl-5.8.x.pkg can not be used.)"
echo " # cd /usr/ports/lang/perl5.8"
echo " # make config"
echo " -> Enable THREADS."
echo " # make"
echo " # make install"
echo " "
echo " Install following tools from ports. Don't use packages."
echo " Recommended: p5-DBI p5-NetAddr-IP p5-XML-Simple p5-XML-Twig p5-HTML-Parser p5-DBD-mysql p5-Socket6 p5-IO-Socket-INET6 p5-JSON"
echo " Optional: nmap xprobe"
echo " "
echo "To get it from source through CPAN do"
echo " "
echo " $ cpan Time::Local DBI Socket6 XML::Simple XML::Twig IO::Socket Time::HiRes NetAddr::IP HTML::Entities IO::Socket::INET6 JSON"
echo " "
rm output
exit 1 exit 1
fi fi
if [ "$DISTRO" != "FreeBSD" ] && [ "$DISTRO" != "NetBSD" ] rm output
echo "Installing binaries and libraries"
make
make DESTDIR=$DESTDIR install
echo "Checking binaries at /usr/local/bin -> /usr/bin"
if [ ! -f "$DESTDIR/usr/bin/pandora_server" ]
then then
ln -s /usr/local/bin/pandora_server $DESTDIR$PREFIX/bin if [ ! -f "$DESTDIR/usr/local/bin/pandora_server" ]
ln -s /usr/local/bin/pandora_exec $DESTDIR$PREFIX/bin then
ln -s /usr/local/bin/tentacle_server $DESTDIR$PREFIX/bin echo "ERROR compiling Pandora FMS Server from sources. Aborting"
exit 1
fi
if [ "$DISTRO" != "FreeBSD" ] && [ "$DISTRO" != "NetBSD" ]
then
ln -s /usr/local/bin/pandora_server $DESTDIR$PREFIX/bin
ln -s /usr/local/bin/pandora_exec $DESTDIR$PREFIX/bin
ln -s /usr/local/bin/tentacle_server $DESTDIR$PREFIX/bin
fi
fi fi
fi fi
@ -484,12 +490,13 @@ help () {
echo " --force Ignore dependency problems and do the install" echo " --force Ignore dependency problems and do the install"
echo " --no-tentacle Skip tentacle server installation (by default tentacle server installed)" echo " --no-tentacle Skip tentacle server installation (by default tentacle server installed)"
echo " --destdir DIR Specify root directory for \"fakeroot\" installation" echo " --destdir DIR Specify root directory for \"fakeroot\" installation"
echo " --from-binary No compile Pandora Server and not execute Makefiles"
echo " " echo " "
} }
# Script banner at start # Script banner at start
echo " " echo " "
echo "Pandora FMS Server Installer $PI_VERSION $PI_BUILD (c) 2008-2015 Artica ST" echo "Pandora FMS Server Installer $PI_VERSION $PI_BUILD (c) 2008-2016 Artica ST"
echo "This program is licensed under GPL2 Terms. http://pandorafms.com" echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
echo " " echo " "
@ -497,12 +504,12 @@ case "$MODE" in
'--install') '--install')
install "$@" install "$@"
exit exit 0
;; ;;
'--uninstall') '--uninstall')
uninstall "$@" uninstall "$@"
exit exit 0
;; ;;
*) *)