From bc05a4818d0f12513edaa090d39cf91bfdf4d95b Mon Sep 17 00:00:00 2001 From: bp-sawyers Date: Fri, 23 Apr 2010 19:29:08 +0000 Subject: [PATCH] Add locking to buildscript on linux, so 2 people can't run a build at the same time. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5876 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- buildcore.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index 01b6d577d..8e172232f 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -29,8 +29,22 @@ UPLOADUSER=bp-sawyers OSNAME=$(uname) +cd `dirname $0` +# Strip the /src/xcat-core from the end of the dir to get the next dir up and use as the release +CURDIR=`pwd` +#D=${CURDIR/\/src\/xcat-core/} +D=${CURDIR%/src/xcat-core} +REL=`basename $D` + if [ "$OSNAME" != "AIX" ]; then GSA=http://pokgsa.ibm.com/projects/x/xcat/build/linux + + # Get a lock, so can not do 2 builds at once + exec 8>/var/lock/xcatbld-$REL.lock + if ! flock -n 8; then; + echo "Can't get lock /var/lock/xcatbld-$REL.lock. Someone else must be doing a build right now. Exiting...." + exit 1 + fi fi set -x @@ -44,13 +58,6 @@ done if [ "$OSNAME" != "AIX" ]; then export HOME=/root # This is so rpm and gpg will know home, even in sudo fi -cd `dirname $0` - -# Strip the /src/xcat-core from the end of the dir to get the next dir up and use as the release -CURDIR=`pwd` -#D=${CURDIR/\/src\/xcat-core/} -D=${CURDIR%/src/xcat-core} -REL=`basename $D` XCATCORE="xcat-core" svn up Version