#!/bin/bash echo $1 echo $2 if test -z "$BUILD_DIST"; then echo Please export BUILD_DIST before running build.; exit fi if test -z "$1"; then echo Usage: buildpac \"mod1 mod2 .... modn\" [\"build flags\"]; echo Ex: buildpac \"evolution-data-server evolution evolution-exchange\" \"--clean --debug=\\\"-g -O0\\\"\"; exit fi curr_date_time=`date +%Y_%m_%d_%H_%M`; if test -z "$BUILD_ROOT"; then export BUILD_ROOT=/abuild/$curr_date_time fi mkdir -p /build/$curr_date_time/RPMS echo Return value of mkdir .../RPMS = $? if test "x$?" != x0; then echo Error occurred while creating /build/$curr_date_time/RPMS directory. exit; fi mkdir -p /build/$curr_date_time/SRPMS if test "x$?" != x0; then echo Error occurred while creating /build/$curr_date_time/SRPMS directory. exit; fi if test "x$BUILD_DIST" == xi386; then BUILD_CMD="`which linux32` `which build`" else if test "x$BUILD_DIST" == xx86_64; then BUILD_CMD="`which build`" fi fi BUILD_CMD="$BUILD_CMD $2" echo $BUILD_CMD for i in $1; do cd $i; echo "building $i in `pwd`" ($BUILD_CMD) if test "x$?" != x0; then echo "Current directory is $i" exit; fi cd .. echo "Building $i is completed and current dir is : `pwd`" cp $BUILD_ROOT/.build.log /build/curr_date_time if test "x$?" != x0; then exit; fi cp -a $BUILD_ROOT/usr/src/packages/RPMS/* /build/$curr_date_time/RPMS/. if test "x$?" != x0; then echo Error occurred while copying RPMS to /build/$curr_date_time/RPMS directory. exit; fi cp -a $BUILD_ROOT/usr/src/packages/SRPMS/* /build/$curr_date_time/SRPMS/. if test "x$?" != x0; then echo Error occurred while copying SRPMS to /build/$curr_date_time/SRPMS directory. exit; fi done