From fee8107acfd546f8ce665791e1f336c3d8bc6353 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 21 Dec 2011 11:38:57 +0000 Subject: [PATCH] 2011-12-21 Ramon Novoa * build_vars.sh: Added to repository. Defines environment variables needed to build Pandora FMS. * build_src.sh, build_windows_agent.sh, build_deb.sh, pandora_update_version.sh, build_rpm.sh: Source build_vars.sh. * build_rpm_redhat.sh: Added to repository. Script to build RPM for Red Hat. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5287 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- extras/ChangeLog | 12 +++++++++ extras/build_deb.sh | 8 +++--- extras/build_rpm.sh | 8 +++--- extras/build_rpm_redhat.sh | 29 ++++++++++++++++++++ extras/build_src.sh | 11 +++----- extras/build_vars.sh | 8 ++++++ extras/build_windows_agent.sh | 3 +-- extras/pandora_update_version.sh | 46 +++++++++++++++++--------------- 8 files changed, 84 insertions(+), 41 deletions(-) create mode 100755 extras/build_rpm_redhat.sh create mode 100644 extras/build_vars.sh diff --git a/extras/ChangeLog b/extras/ChangeLog index 8e6b46735b..4ed13e4089 100644 --- a/extras/ChangeLog +++ b/extras/ChangeLog @@ -1,3 +1,15 @@ +2011-12-21 Ramon Novoa + + * build_vars.sh: Added to repository. Defines environment variables + needed to build Pandora FMS. + + * build_src.sh, build_windows_agent.sh, + build_deb.sh, pandora_update_version.sh, + build_rpm.sh: Source build_vars.sh. + + * build_rpm_redhat.sh: Added to repository. Script to build + RPM for Red Hat. + 2011-12-14 Ramon Novoa * pandora_update_version.sh: Update CLI and DB maintenance scripts diff --git a/extras/build_deb.sh b/extras/build_deb.sh index 178dc242db..787929c543 100755 --- a/extras/build_deb.sh +++ b/extras/build_deb.sh @@ -1,7 +1,5 @@ #!/bin/bash -CODEHOME=~/code/pandora/trunk -CODEHOME_ENT=~/code/artica/code -RPMHOME=/usr/src/packages +source build_vars.sh if [ ! -d $RPMHOME/DEB ]; then mkdir -p $RPMHOME/DEB || exit 1 @@ -19,10 +17,10 @@ cd $CODEHOME/pandora_server/DEBIAN && bash ./make_deb_package.sh && mv ../*.deb cd $CODEHOME/pandora_agents/unix/DEBIAN && bash ./make_deb_package.sh && mv ../*.deb $RPMHOME/DEB || exit 1 # Enterprise console -cd $CODEHOME_ENT/pandora/trunk/pandora_console/DEBIAN && bash ./make_deb_package.sh && mv ../*.deb $RPMHOME/DEB || exit 1 +cd $PANDHOME_ENT/pandora_console/DEBIAN && bash ./make_deb_package.sh && mv ../*.deb $RPMHOME/DEB || exit 1 # Enterprise server -cd $CODEHOME_ENT/pandora/trunk/pandora_server/PandoraFMS-Enterprise/DEBIAN && bash ./make_deb_package.sh && mv ../*.deb $RPMHOME/DEB || exit 1 +cd $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/DEBIAN && bash ./make_deb_package.sh && mv ../*.deb $RPMHOME/DEB || exit 1 exit 0 diff --git a/extras/build_rpm.sh b/extras/build_rpm.sh index fe5486bfad..590b7a14a6 100755 --- a/extras/build_rpm.sh +++ b/extras/build_rpm.sh @@ -1,7 +1,5 @@ #!/bin/bash -CODEHOME=~/code/pandora/trunk -CODEHOME_ENT=~/code/artica/code -RPMHOME=/usr/src/packages +source build_vars.sh if [ ! -d $RPMHOME/RPMS ]; then mkdir -p $RPMHOME/RPMS || exit 1 @@ -19,10 +17,10 @@ rpmbuild -ba $CODEHOME/pandora_server/pandora_server.spec || exit 1 rpmbuild -ba $CODEHOME/pandora_agents/unix/pandora_agent.spec || exit 1 # Enterprise console -rpmbuild -ba $CODEHOME_ENT/pandora/trunk/pandora_console/enterprise/pandora_console_enterprise.spec || exit 1 +rpmbuild -ba $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec || exit 1 # Enterprise server -rpmbuild -ba $CODEHOME_ENT/pandora/trunk/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec || exit 1 +rpmbuild -ba $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec || exit 1 # Updatemanager keygen rpmbuild -ba $CODEHOME_ENT/updatemanager/keygen/pandora/pandora_keygen.spec || exit 1 diff --git a/extras/build_rpm_redhat.sh b/extras/build_rpm_redhat.sh new file mode 100755 index 0000000000..d23272daf5 --- /dev/null +++ b/extras/build_rpm_redhat.sh @@ -0,0 +1,29 @@ +#!/bin/bash +source build_vars.sh + +if [ ! -d $RPMHOME/RPMS ]; then + mkdir -p $RPMHOME/RPMS || exit 1 +fi + +echo "Creating RPM packages in $RPMHOME/RPMS" + +# Console +rpmbuild -ba $CODEHOME/pandora_console/pandora_console.redhat.spec || exit 1 + +# Server +rpmbuild -ba $CODEHOME/pandora_server/pandora_server.redhat.spec || exit 1 + +# Unix agent +rpmbuild -ba $CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec || exit 1 + +# Enterprise console +rpmbuild -ba $PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec || exit 1 + +# Enterprise server +rpmbuild -ba $PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec || exit 1 + +# Updatemanager keygen +rpmbuild -ba $CODEHOME_ENT/updatemanager/keygen/pandora/pandora_keygen.redhat.spec || exit 1 + +exit 0 + diff --git a/extras/build_src.sh b/extras/build_src.sh index 7aa8435f99..0ffcbb3f8b 100755 --- a/extras/build_src.sh +++ b/extras/build_src.sh @@ -1,10 +1,5 @@ #!/bin/bash -CODEHOME=~/code/pandora/trunk -CODEHOME_ENT=~/code/artica/code -RPMHOME=/usr/src/packages -VERSION=$(grep 'my $pandora_version =' $CODEHOME/pandora_server/lib/PandoraFMS/Config.pm | awk '{print substr($4, 2, length($4) - 3)}') -BUILD=$(grep 'my $pandora_build =' $CODEHOME/pandora_server/lib/PandoraFMS/Config.pm | awk '{print substr($4, 2, length($4) - 3)}') -KEYGEN_VERSION=$(grep "%define version" $CODEHOME_ENT/updatemanager/keygen/pandora/pandora_keygen.spec | awk '{print $3}') +source build_vars.sh # Add build string for nightly builds if [ "$1" == "nightly" ]; then @@ -32,10 +27,10 @@ cd $CODEHOME/pandora_agents/shellscript && tar zcvf $RPMHOME/SOURCES/pandorafms_ cd $CODEHOME/pandora_agents && tar zvcf $RPMHOME/SOURCES/pandorafms_agent_unix-$LOCAL_VERSION.tar.gz --exclude \.svn --exclude nohup --exclude NT4 unix || exit 1 # Enterprise console -cd $CODEHOME_ENT/pandora/trunk/pandora_console && tar zcvf $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz --exclude \.svn enterprise/* || exit 1 +cd $PANDHOME_ENT/pandora_console && tar zcvf $RPMHOME/SOURCES/pandorafms_console_enterprise-$LOCAL_VERSION.tar.gz --exclude \.svn enterprise/* || exit 1 # Enterprise server -cd $CODEHOME_ENT/pandora/trunk/pandora_server/ && tar zcvf $RPMHOME/SOURCES/pandorafms_server_enterprise-$LOCAL_VERSION.tar.gz --exclude \.svn PandoraFMS-Enterprise || exit 1 +cd $PANDHOME_ENT/pandora_server/ && tar zcvf $RPMHOME/SOURCES/pandorafms_server_enterprise-$LOCAL_VERSION.tar.gz --exclude \.svn PandoraFMS-Enterprise || exit 1 # Updatemanager keygen cd $CODEHOME_ENT/updatemanager/keygen && tar cvzf $RPMHOME/SOURCES/pandorafms_keygen-$KEYGEN_VERSION.tar.gz --exclude .svn --exclude keygen --exclude keygen.i386.static --exclude pandora_keygen.spec pandora || exit 1 diff --git a/extras/build_vars.sh b/extras/build_vars.sh new file mode 100644 index 0000000000..c13925cb4f --- /dev/null +++ b/extras/build_vars.sh @@ -0,0 +1,8 @@ +#!/bin/bash +CODEHOME=~/code/pandora/trunk +CODEHOME_ENT=~/code/artica/code +PANDHOME_ENT=$CODEHOME_ENT/pandora/trunk +RPMHOME=/usr/src/packages +VERSION=$(grep 'my $pandora_version =' $CODEHOME/pandora_server/lib/PandoraFMS/Config.pm | awk '{print substr($4, 2, length($4) - 3)}') +BUILD=$(grep 'my $pandora_build =' $CODEHOME/pandora_server/lib/PandoraFMS/Config.pm | awk '{print substr($4, 2, length($4) - 3)}') +KEYGEN_VERSION=$(grep "%define version" $CODEHOME_ENT/updatemanager/keygen/pandora/pandora_keygen.spec | awk '{print $3}') diff --git a/extras/build_windows_agent.sh b/extras/build_windows_agent.sh index d1df0c346b..a40c64e0cc 100755 --- a/extras/build_windows_agent.sh +++ b/extras/build_windows_agent.sh @@ -1,6 +1,5 @@ #!/bin/bash -CODEHOME=~/code/pandora/trunk -RPMHOME=/usr/src/packages +source build_vars.sh if [ ! -d $RPMHOME/EXE ]; then mkdir -p $RPMHOME/EXE || exit 1 diff --git a/extras/pandora_update_version.sh b/extras/pandora_update_version.sh index 2e6c40d647..6df7966d1c 100755 --- a/extras/pandora_update_version.sh +++ b/extras/pandora_update_version.sh @@ -1,5 +1,6 @@ #!/bin/bash # Automatically update Pandora FMS version and build where necessary. +source build_vars.sh # Check command line arguments if [ $# -lt 2 ] || [ $# -gt 3 ]; then @@ -20,27 +21,30 @@ else BUILD=$3 fi TEMP_FILE="/tmp/pandora_update_version.tmp" -CODE_HOME=~/code/pandora/trunk -CODE_HOME_ENT=~/code/artica/code -SPEC_FILES="$CODE_HOME/pandora_console/pandora_console.spec \ -$CODE_HOME/pandora_agents/unix/pandora_agent.spec \ -$CODE_HOME/pandora_server/pandora_server.spec \ -$CODE_HOME_ENT/pandora/trunk/pandora_console/enterprise/pandora_console_enterprise.spec \ -$CODE_HOME_ENT/pandora/trunk/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec" -DEBIAN_FILES="$CODE_HOME/pandora_console/DEBIAN \ -$CODE_HOME/pandora_server/DEBIAN \ -$CODE_HOME/pandora_agents/unix/DEBIAN \ -$CODE_HOME_ENT/pandora/trunk/pandora_console/DEBIAN \ -$CODE_HOME_ENT/pandora/trunk/pandora_server/PandoraFMS-Enterprise/DEBIAN" -SERVER_FILE="$CODE_HOME/pandora_server/lib/PandoraFMS/Config.pm" -SERVER_DB_FILE="$CODE_HOME/pandora_server/util/pandora_db.pl" -SERVER_CLI_FILE="$CODE_HOME/pandora_server/util/pandora_manage.pl" -CONSOLE_DB_FILE="$CODE_HOME/pandora_console/pandoradb_data.sql" -CONSOLE_FILE="$CODE_HOME/pandora_console/include/config_process.php" -CONSOLE_INSTALL_FILE="$CODE_HOME/pandora_console/install.php" -AGENT_UNIX_FILE="$CODE_HOME/pandora_agents/unix/pandora_agent" -AGENT_WIN_FILE="$CODE_HOME/pandora_agents/win32/pandora.cc" -AGENT_WIN_MPI_FILE="$CODE_HOME/pandora_agents/win32/installer/pandora.mpi" +SPEC_FILES="$CODEHOME/pandora_console/pandora_console.spec \ +$CODEHOME/pandora_agents/unix/pandora_agent.spec \ +$CODEHOME/pandora_server/pandora_server.spec \ +$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.spec \ +$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.spec \ +$CODEHOME/pandora_console/pandora_console.redhat.spec \ +$CODEHOME/pandora_agents/unix/pandora_agent.redhat.spec \ +$CODEHOME/pandora_server/pandora_server.redhat.spec \ +$PANDHOME_ENT/pandora_console/enterprise/pandora_console_enterprise.redhat.spec \ +$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/pandora_server_enterprise.redhat.spec" +DEBIAN_FILES="$CODEHOME/pandora_console/DEBIAN \ +$CODEHOME/pandora_server/DEBIAN \ +$CODEHOME/pandora_agents/unix/DEBIAN \ +$PANDHOME_ENT/pandora_console/DEBIAN \ +$PANDHOME_ENT/pandora_server/PandoraFMS-Enterprise/DEBIAN" +SERVER_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/Config.pm" +SERVER_DB_FILE="$CODEHOME/pandora_server/util/pandora_db.pl" +SERVER_CLI_FILE="$CODEHOME/pandora_server/util/pandora_manage.pl" +CONSOLE_DB_FILE="$CODEHOME/pandora_console/pandoradb_data.sql" +CONSOLE_FILE="$CODEHOME/pandora_console/include/config_process.php" +CONSOLE_INSTALL_FILE="$CODEHOME/pandora_console/install.php" +AGENT_UNIX_FILE="$CODEHOME/pandora_agents/unix/pandora_agent" +AGENT_WIN_FILE="$CODEHOME/pandora_agents/win32/pandora.cc" +AGENT_WIN_MPI_FILE="$CODEHOME/pandora_agents/win32/installer/pandora.mpi" # Update version in spec files function update_spec_version {