#!/bin/bash -x # # Copyright (C) 2008 GroundWork Open Source, Inc. ("GroundWork") # info@groundworkopensource.com # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License # as published by the Free Software Foundation. # # 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. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Build properties for Monitor Core # # Check distro if [ -f /etc/redhat-release ] ; then RHEL_NO=$(fgrep "release" /etc/redhat-release | awk '{ print $7; }') distro=rhel$RHEL_NO builddir=redhat elif [ -f /etc/SuSE-release ] ; then RHEL_NO=$(fgrep "VERSION" /etc/SuSE-release | awk '{ print $3; }') distro=sles$RHEL_NO builddir=packages else echo "No support for your OS..." exit 1 fi arch=$(arch) if [ "$arch" == "x86_64" ] ; then export ARCH='_64' libdir=lib64 else libdir=lib fi PATH=$PATH:$HOME/bin export GW_HOME=/usr/local/groundwork export JAVA_HOME=$(which java|sed 's/\/bin\/java//') export ANT_HOME=$(which ant|sed 's/\/bin\/ant//') export MAVEN_HOME=$(which maven|sed 's/\/bin\/maven//') export LDFLAGS=-L$GW_HOME/$libdir export LD_RUN_PATH=$GW_HOME/$libdir:$LD_RUN_PATH export LD_LIBRARY_PATH=$GW_HOME/$libdir:$LD_LIBRARY_PATH export CPPFLAGS=-I$GW_HOME/include export PATH=$JAVA_HOME/bin:$GW_HOME/bin:$PATH:$MAVEN_HOME/bin:$ANT_HOME/bin HOME=/home/nagios BASE=$HOME/groundwork-monitor BUILD_DIR=$BASE/build SPECS_HOME=$BASE/monitor-os/spec # Clean up previous builds rm -rf $HOME/groundwork* # Clean up previous builds rm -rf /groundwork-monitor* rm -rf /usr/src/redhat/BUILD/groundwork-monitor-core* rm -rf /usr/src/redhat/SOURCE/groundwork-monitor-core* rm -rf /usr/src/redhat/SRPMS/* rm -rf /usr/local/groundwork/ cd $HOME # Check out from subversion svn co http://archive.groundworkopensource.com/groundwork-opensource/trunk groundwork-monitor # Special needs for diffrent OS if [ "$builddir" == "redhat" ] && [ "$distro" == "rhel5" ] ; then if [ "$arch" == "x86_64" ] ; then # RH5 64 bit specific build file for apache /bin/cp -f $BASE/monitor-core/apache/httpd-64.init $BASE/monitor-core/apache/httpd.init /bin/cp -f $BASE/monitor-core/apache/maven.xml.rh5_64 $BASE/monitor-core/apache/maven.xml /bin/cp -f $BASE/monitor-core/syslib/maven.xml.rh5_64 $BASE/monitor-core/syslib/maven.xml /bin/cp -f $BASE/monitor-core/snmp/maven.xml.rh564 $BASE/monitor-core/snmp/maven.xml else # For RH5 only, since it gets LDAP error with: # with-ldap=${org.groundwork.deploy.prefix} /bin/cp -f $BASE/monitor-core/apache/maven.xml.rh5 $BASE/monitor-core/apache/maven.xml /bin/cp -f $BASE/monitor-core/syslib/maven.xml.rh5 $BASE/monitor-core/syslib/maven.xml fi elif [ "$builddir" == "redhat" ] && [ "$distro" == "rhel4" ] ; then if [ "$arch" == "x86_64" ] ; then # RH4 64 bit specific build file for nagios/sqlite /bin/cp -f $BASE/monitor-core/nagios/maven.xml.RH4-64 $BASE/monitor-core/nagios/maven.xml /bin/cp -f $BASE/monitor-core/apache/httpd-64.init $BASE/monitor-core/apache/httpd.init else # RH4 32 bit specific build file for nagios/sqlite /bin/cp -f $BASE/monitor-core/nagios/maven.xml.RH4-32 $BASE/monitor-core/nagios/maven.xml fi elif [ "$builddir" == "packages" ] ; then if [ "$distro" == "sles9" ] ; then # Build GDBM package for NTOP for SuSE9 /bin/cp -f $BASE/monitor-core/gd2/maven.xml.suse9 $BASE/monitor-core/gd2/maven.xml elif [ "$arch" != "x86_64" ] ; then # The new SuSE10 is rebuild. New SuSE10 has libexpat.so.0 linked to libexpat.so.1.=5.0 # on its system library, but this linked-library is missing on the other SuSE10 /bin/cp -f $BASE/monitor-os/build/master-build.sh.suse1032 $BASE/monitor-os/build/master-build.sh else /bin/cp -f $BASE/monitor-core/apache/httpd-64.init $BASE/monitor-core/apache/httpd.init fi fi /bin/cp $BASE/monitor-os/maven-sb.xml $BASE/maven.xml /bin/mkdir $BASE/guava-packages /bin/cp $BASE/monitor-os/maven-guava-packages-sb.xml $BASE/guava-packages/maven.xml /bin/rm -rf $BUILD_DIR/master-build.sh /bin/cp $BASE/monitor-os/build/master-build.sh $BUILD_DIR/master-build-os.sh if [ "$arch" == "x86_64" ] ; then # Patch for x86_64 arch cd /home/nagios/groundwork-monitor/build/build-x86_64 . install64bitPatch.sh fi export PERLCC=gcc echo "Default Perl compiler: ($PERLCC)" # Start master build script cd $BUILD_DIR . master-build-os.sh echo "groundwork-monitor-core build is done."