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 38a66e7cfc
commit fb9731bd76
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> 2010-06-28 Sergio Martin <sergio.martin@artica.es>
* include/functions_db.php: Fixed the get_agent_modules * 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("PEAR.php","PEAR PHP Library");
$res += check_include("DB.php","PEAR:DB PHP Library"); $res += check_include("DB.php","PEAR:DB PHP Library");
$res += check_include("XML/RPC.php","PEAR::XML_RPC PHP Library"); $res += check_include("XML/RPC.php","PEAR::XML_RPC PHP Library");
$res += check_exists ("/usr/bin/twopi","Graphviz Binary"); 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 "</table>";
echo "</div>"; echo "</div>";

View File

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