#!/bin/bash # description: monitor-core build script # # Copyright 2007 GroundWork Open Source, Inc. (“GroundWork”) # All rights reserved. This program is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License version 2 # 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 # Street, Fifth Floor, Boston, MA 02110-1301, USA. # # Declaring build directories and varibles SOURCE_DIR=/home/nagios/groundwork-monitor/build/SOURCE DOWNLOAD_URL=ftp://archive.groundworkopensource.com/pub/groundwork-core SECTION1=gd2 SECTION2=perl SECTION3=syslib SECTION4=apache SECTION5=nagios gd2_source_files=($(/bin/fgrep "com.groundwork.gd2" ../monitor-core/project.properties|awk '{print $3}')) perl_source_files=($(/bin/fgrep "com.groundwork.perl" ../monitor-core/project.properties|awk '{print $3}')) syslib_source_files=($(/bin/fgrep "com.groundwork.syslib" ../monitor-core/project.properties|awk '{print $3}')) apache_source_files=($(/bin/fgrep "com.groundwork.apache" ../monitor-core/project.properties|awk '{print $3}')) nagios_source_files=($(/bin/fgrep "com.groundwork.nagios" ../monitor-core/project.properties|awk '{print $3}')) # Dowload $SECTION1 SOURCES mkdir -p $SOURCE_DIR mkdir -p $SOURCE_DIR/gd2 cd $SOURCE_DIR/gd2 n=0 #Reset counter for i in ${gd2_source_files[@]}; do # sleep 1 wget -c -q $DOWNLOAD_URL/gd2/"${gd2_source_files[n]}.tar.gz" &&\ echo -en DOWNLOADING: "${gd2_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;32m'"\033[63GOK\033[0m" ] ||{ echo -en DOWNLOADING: "${gd2_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;31m'"\033[63GFAILED\033[0m" ] exit $? } let n+=1 done cd $SOURCE_DIR # Dowload $SECTION2 SOURCES mkdir -p $SOURCE_DIR/perl cd $SOURCE_DIR/perl n=0 #Reset counter for i in ${perl_source_files[@]}; do sleep 1 wget -c -q $DOWNLOAD_URL/perl/"${perl_source_files[n]}.tar.gz" &&\ echo -en DOWNLOADING: "${perl_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;32m'"\033[63GOK\033[0m" ] ||{ echo -en DOWNLOADING: "${perl_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;31m'"\033[63GFAILED\033[0m" ] exit $? } let n+=1 done cd $SOURCE_DIR # Dowload $SECTION3 SOURCES mkdir -p $SOURCE_DIR/syslib cd $SOURCE_DIR/syslib n=0 #Reset counter for i in ${syslib_source_files[@]}; do sleep 1 wget -c -q $DOWNLOAD_URL/syslib/"${syslib_source_files[n]}.tar.gz" &&\ echo -en DOWNLOADING: "${syslib_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;32m'"\033[63GOK\033[0m" ] ||{ echo -en DOWNLOADING: "${syslib_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;31m'"\033[63GFAILED\033[0m" ] exit $? } let n+=1 done cd $SOURCE_DIR # Dowload $SECTION4 SOURCES mkdir -p $SOURCE_DIR/apache cd $SOURCE_DIR/apache n=0 #Reset counter for i in ${apache_source_files[@]}; do sleep 1 wget -c -q $DOWNLOAD_URL/apache/"${apache_source_files[n]}.tar.gz" &&\ echo -en DOWNLOADING: "${apache_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;32m'"\033[63GOK\033[0m" ] ||{ echo -en DOWNLOADING: "${apache_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;31m'"\033[63GFAILED\033[0m" ] exit $? } let n+=1 done cd $SOURCE_DIR # Dowload $SECTION5 SOURCES mkdir -p $SOURCE_DIR/nagios cd $SOURCE_DIR/nagios n=0 #Reset counter for i in ${nagios_source_files[@]}; do sleep 1 wget -c -q $DOWNLOAD_URL/nagios/"${nagios_source_files[n]}.tar.gz" &&\ echo -en DOWNLOADING: "${nagios_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;32m'"\033[63GOK\033[0m" ] ||{ echo -en DOWNLOADING: "${nagios_source_files[n]}" &&\ echo -en '\E[0m'"\033[61G[\033[0m" &&\ echo -e '\E[1;37;31m'"\033[63GFAILED\033[0m" ] exit $? } let n+=1 done cd $SOURCE_DIR