2009-09-21 Evi Vanoost <vanooste@rcbi.rochester.edu>

* pandora_server_installer: Fixed a few bugs on non-Linux platforms
	
	* util/pandora_server, util/tentacle_serverd: Didn't work on Linux 
	(Ubuntu). Fixed she-bang.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1964 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-09-21 20:26:23 +00:00
parent 63216a678e
commit 5ccd4995de
4 changed files with 120 additions and 67 deletions

View File

@ -1,3 +1,10 @@
2009-09-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
* pandora_server_installer: Fixed a few bugs on non-Linux platforms
* util/pandora_server, util/tentacle_serverd: Didn't work on Linux
(Ubuntu). Fixed she-bang.
2009-09-21 Sancho Lerena <slerena@artica.es> 2009-09-21 Sancho Lerena <slerena@artica.es>
* pandora_server.spec: Fixed a few details. * pandora_server.spec: Fixed a few details.

View File

@ -12,36 +12,50 @@ MODE=$1
SECOPT=$2 SECOPT=$2
get_distro () { get_distro () {
# Get Linux Distro type and version # Get Linux Distro type and version
# We assume we are on Linux unless told otherwise
LINUX=TRUE
if [ -f "/etc/SuSE-release" ] if [ -f "/etc/SuSE-release" ]
then then
OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "`
LINUX_DISTRO=SUSE 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=FALSE
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=FALSE
elif [ `uname -s` == "Linux" ]
then
# Test for Linux to make sure we're on Linux
LINUX_DISTRO="GENERIC"
OS_VERSION=`uname -r`
else else
if [ -f "/etc/lsb-release" ] # Default to Linux is false, test for real Linux above - that way we don't assume we can just plunk down files everywhere
then LINUX_DISTRO=`uname -s`
OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="` OS_VERSION=`uname -r`
LINUX_DISTRO=UBUNTU LINUX=FALSE
OS_VERSION="UBUNTU $OS_VERSION"
else
if [ -f "/etc/debian_version" ]
then
OS_VERSION=`cat /etc/debian_version`
OS_VERSION="DEBIAN $OS_VERSION"
LINUX_DISTRO=DEBIAN
else
if [ -f "/etc/fedora-release" ]
then
OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "`
OS_VERSION="FEDORA $OS_VERSION"
LINUX_DISTRO=FEDORA
else
LINUX_DISTRO=GENERIC
OS_VERSION=`uname -r`
fi
fi
fi
fi fi
echo $LINUX_DISTRO echo $LINUX_DISTRO
} }
@ -77,9 +91,7 @@ install () {
if [ "$DISTRO" == "UBUNTU" ] if [ "$DISTRO" == "UBUNTU" ]
then then
echo "UBUNTU distribution detected" echo "UBUNTU distribution detected"
fi elif [ "$DISTRO" == "SUSE" ]
if [ "$DISTRO" == "SUSE" ]
then then
echo "SUSE distribution detected" echo "SUSE distribution detected"
fi fi
@ -89,31 +101,54 @@ install () {
make install make install
echo "Creating common Pandora FMS directories" echo "Creating common Pandora FMS directories"
mkdir /var/spool/pandora 2> /dev/null
mkdir /var/spool/pandora/data_in 2> /dev/null
mkdir /var/spool/pandora/data_in/conf 2> /dev/null
mkdir /var/spool/pandora/data_in/md5 2> /dev/null
id pandora id pandora
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo " " echo " "
echo "User pandora does exist, make sure the SSH directories are correct" echo "User pandora does exist, make sure the SSH directories are correct"
else else
echo "Creating 'pandora' user" echo "Are you sure we can create a standard 'pandora' user locally? [y/N]"
useradd pandora read AREYOUSURE
mkdir /home/pandora 2> /dev/null if [ "$AREYOUSURE" == "y" ]; then
mkdir /home/pandora/.ssh 2> /dev/null useradd pandora
chown -R pandora /home/pandora mkdir /home/pandora 2> /dev/null
mkdir /home/pandora/.ssh 2> /dev/null
chown -R pandora /home/pandora
else
echo "Please create the 'pandora' user manually according to your authentication scheme then restart the installation"
echo "Aborting..."
exit 1
fi
fi fi
mkdir /var/spool/pandora 2> /dev/null
mkdir /var/spool/pandora/data_in 2> /dev/null
mkdir /var/spool/pandora/data_in/conf 2> /dev/null
mkdir /var/spool/pandora/data_in/md5 2> /dev/null
mkdir /var/log/pandora 2> /dev/null mkdir /var/log/pandora 2> /dev/null
echo "Giving proper permission to /var/spool/pandora" echo "Giving proper permission to /var/spool/pandora"
if [ "$DISTRO" == "UBUNTU" ] id -g www-data > /dev/null
if [ $? -eq 0 ]
then then
chown -R pandora:www-data /var/spool/pandora/ chown -R pandora:www-data /var/spool/pandora/
else else
chown -R pandora:www /var/spool/pandora/ 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 fi
echo "Creating setup directory in /etc/pandora" echo "Creating setup directory in /etc/pandora"
mkdir /etc/pandora 2> /dev/null mkdir /etc/pandora 2> /dev/null
if [ -e /etc/pandora/pandora_server.conf ] if [ -e /etc/pandora/pandora_server.conf ]
@ -125,43 +160,54 @@ install () {
cp conf/pandora_server.conf /etc/pandora/ cp conf/pandora_server.conf /etc/pandora/
chmod 770 /etc/pandora/pandora_server.conf chmod 770 /etc/pandora/pandora_server.conf
echo "Copying the daemon script into /etc/init.d/pandora_server" if [ "$LINUX" == TRUE ]
cp util/pandora_server /etc/init.d/
if [ "$DISTRO" == "UBUNTU" ]
then then
echo "Linking startup script to /etc/rc2.d" echo "Copying the daemon script into /etc/init.d/pandora_server"
ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server cp util/pandora_server /etc/init.d/
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
echo "Creating logrotate.d entry for Pandora FMS log management"
cp util/pandora_logrotate /etc/logrotate.d/pandora
if [ "$SECOPT" != "--no-tentacle" ]
then
if [ "$DISTRO" == "UBUNTU" ] if [ "$DISTRO" == "UBUNTU" ]
then then
# Tentacle server install (Ubuntu) echo "Linking startup script to /etc/rc2.d"
echo "Installing tentacle server in /etc/rc2.d/S80tentacle_serverd" ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server
cp bin/tentacle_server /usr/local/bin
cp util/tentacle_serverd /etc/init.d/tentacle_serverd
ln -s /etc/init.d/tentacle_serverd /etc/rc2.d/S80tentacle_serverd
else else
# Tentacle server install (SUSE) INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"`
echo "Installing tentacle server in /etc/rc.d/rc$INITLV.d/S80tentacle_serverd" echo "Linking startup script to /etc/rc.d/rc$INITLV.d"
cp bin/tentacle_server /usr/local/bin ln -s /etc/init.d/pandora_server /etc/rc.d/rc$INITLV.d/S90pandora_server
cp util/tentacle_serverd /etc/init.d/tentacle_serverd fi
ln -s /etc/init.d/tentacle_serverd /etc/rc.d/rc$INITLV.d/S80tentacle_serverd 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" == TRUE ]
then
if [ "$SECOPT" != "--no-tentacle" ]
then
if [ "$DISTRO" == "UBUNTU" ]
then
# Tentacle server install (Ubuntu)
echo "Installing tentacle server in /etc/rc2.d/S80tentacle_serverd"
cp bin/tentacle_server /usr/local/bin
cp util/tentacle_serverd /etc/init.d/tentacle_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"
cp bin/tentacle_server /usr/local/bin
cp util/tentacle_serverd /etc/init.d/tentacle_serverd
ln -s /etc/init.d/tentacle_serverd /etc/rc.d/rc$INITLV.d/S80tentacle_serverd
fi
fi fi
fi fi
echo "Creating Pandora FMS distribution directory in /usr/share/pandora" echo "Creating Pandora FMS distribution directory in /usr/share/pandora"
mkdir /usr/share/pandora 2> /dev/null mkdir /usr/share/pandora 2> /dev/null
cp -R util /usr/share/pandora cp -R util /usr/share/pandora
if [ -d /etc/cron.daily ] if [ -d /etc/cron.daily ]
then then
echo "#!/bin/bash" > /etc/cron.daily/pandora_purge_db echo "#!/bin/bash" > /etc/cron.daily/pandora_purge_db

View File

@ -1,4 +1,4 @@
#! /bin/sh #!/bin/bash
# Copyright (c) 2005-2009 Artica ST # Copyright (c) 2005-2009 Artica ST
# #
# Author: Sancho Lerena <slerena@artica.es> 2006-2009 # Author: Sancho Lerena <slerena@artica.es> 2006-2009

View File

@ -1,4 +1,4 @@
#! /bin/sh #!/bin/bash
# Copyright (c) 2005-2009 Artica ST # Copyright (c) 2005-2009 Artica ST
# #
# Author: Sancho Lerena <slerena@artica.es> 2006-2009 # Author: Sancho Lerena <slerena@artica.es> 2006-2009