2010-06-29 Junichi Satoh <junichi@rworks.jp>

* pandora_console_install: Added support for FreeBSD and RHEL/CentOS.

	* install.php: Added support for FreeBSD.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2930 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2010-06-29 01:19:44 +00:00
parent 28028ec080
commit 67e46066e8
3 changed files with 100 additions and 19 deletions

View File

@ -1,3 +1,9 @@
2010-06-29 Junichi Satoh <junichi@rworks.jp>
* pandora_console_install: Added support for FreeBSD and RHEL/CentOS.
* install.php: Added support for FreeBSD.
2010-06-28 Sergio Martin <sergio.martin@artica.es>
* include/functions_db.php: Fixed the get_agent_modules

View File

@ -307,7 +307,11 @@ function install_step2() {
$res += check_include("PEAR.php","PEAR PHP Library");
$res += check_include("DB.php","PEAR:DB PHP Library");
$res += check_include("XML/RPC.php","PEAR::XML_RPC PHP Library");
if (PHP_OS == "FreeBSD") {
$res += check_exists ("/usr/local/bin/twopi","Graphviz Binary");
} else {
$res += check_exists ("/usr/bin/twopi","Graphviz Binary");
}
echo "</table>";
echo "</div>";

View File

@ -1,7 +1,8 @@
#!/bin/bash
#!/bin/sh
# Pandora FMS Console Installer (c) 2008-2010 Artica ST
# Linux Version (generic), for SuSe and Debian/Ubuntu only
# Linux/FreeBSD Version (generic), for SuSe, Debian/Ubuntu, RHEL/CentOS and
# FreeBSD only
# other Linux distros could not work properly without modifications
# Please see http://www.pandorafms.org
# v3.0 Build 091224
@ -16,6 +17,8 @@ MODE=$1
get_distro () {
OS_NAME=`uname -s`
# Get Linux Distro type and version
if [ -f "/etc/SuSE-release" ]
then
@ -39,17 +42,46 @@ get_distro () {
OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "`
OS_VERSION="FEDORA $OS_VERSION"
LINUX_DISTRO=FEDORA
else
if [ -f "/etc/redhat-release" ]
then
LINUX_DISTRO=RHEL_CENTOS
else
if [ "$OS_NAME" = "FreeBSD" ]
then
LINUX_DISTRO=FreeBSD
else
LINUX_DISTRO=GENERIC
fi
OS_VERSION=`uname -r`
fi
fi
fi
fi
fi
echo $LINUX_DISTRO
}
uninstall () {
DISTRO=`get_distro`
if [ "$DISTRO" = "UBUNTU" ]
then
PANDORA_HOME=/var/www/pandora
else
if [ "$DISTRO" = "RHEL_CENTOS" ]
then
PANDORA_HOME=/var/www/html/pandora_console
else
if [ "$DISTRO" = "FreeBSD" ]
then
PANDORA_HOME="/usr/local/www/data/pandora_console /usr/local/www/apache22/data/pandora_console"
else
PANDORA_HOME=/srv/www/htdocs/pandora
fi
fi
fi
echo "Removing Pandora FMS Console"
rm -Rf $PANDORA_HOME
echo "You need to manually drop pandora database from your Database server"
@ -61,16 +93,33 @@ install () {
DISTRO=`get_distro`
OLDFILENAMETMP=`date +"%Y-%m-%d"`
if [ "$DISTRO" == "UBUNTU" ]
if [ "$DISTRO" = "UBUNTU" ]
then
PANDORA_HOME=/var/www/pandora
PANDORA_CONF=$PANDORA_HOME/include/config.php
else
if [ "$DISTRO" = "RHEL_CENTOS" ]
then
PANDORA_HOME=/var/www/html/pandora_console
PANDORA_CONF=$PANDORA_HOME/include/config.php
else
if [ "$DISTRO" = "FreeBSD" ]
then
if [ -d /usr/local/www/apache22 ]
then
PANDORA_HOME=/usr/local/www/apache22/data/pandora_console
else
PANDORA_HOME=/usr/local/www/data/pandora_console
fi
PANDORA_CONF=$PANDORA_HOME/include/config.php
else
PANDORA_HOME=/srv/www/htdocs/pandora
PANDORA_CONF=$PANDORA_HOME/include/config.php
fi
fi
fi
echo "Detecting Linux distribution: $DISTRO"
echo "Detecting operating system: $DISTRO"
if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ]
then
@ -83,7 +132,7 @@ install () {
# Create directories
echo "Creating Pandora FMS Console home directory at $PANDORA_HOME ..."
mkdir $PANDORA_HOME 2> /dev/null
mkdir -p $PANDORA_HOME 2> /dev/null
# Copying Pandora FMS console
echo "Copying Pandora FMS Console to $PANDORA_HOME.."
@ -92,28 +141,50 @@ install () {
# Creating 'pandora' user
id pandora
id pandora 2> /dev/null
if [ $? -eq 0 ]; then
echo " "
echo "User pandora does exist, skipping this step"
else
echo "Creating 'pandora' user"
if [ "$DISTRO" = "FreeBSD" ]
then
echo "pandora:41121:::::Pandora FMS:/home/pandora:/usr/sbin/nologin:" | adduser -f - -w no 2> /dev/null
else
useradd pandora
mkdir /home/pandora 2> /dev/null
mkdir /home/pandora/.ssh 2> /dev/null
chown -R pandora /home/pandora
fi
fi
if [ ! -d /var/spool/pandora ]
then
mkdir -p /var/spool/pandora
fi
#Ownership
if [ "$DISTRO" == "UBUNTU" ]
if [ "$DISTRO" = "UBUNTU" ]
then
chown -R www-data:root $PANDORA_HOME
chown -R pandora:www-data /var/spool/pandora/
else
if [ "$DISTRO" = "RHEL_CENTOS" ]
then
chown -R apache:apache $PANDORA_HOME
chown -R pandora:apache /var/spool/pandora/
else
if [ "$DISTRO" = "FreeBSD" ]
then
chown -R www:www $PANDORA_HOME
chown -R pandora:www /var/spool/pandora/
else
# Assuming SUSE
chown -R wwwrun:root $PANDORA_HOME
chown -R pandora:www /var/spool/pandora/
fi
fi
fi
echo "Setting secure permissions for Pandora FMS spool dir..."
chmod -R u+rwX,g+rwX,o-rwx /var/spool/pandora/