2011-12-19 17:01:18 +00:00
|
|
|
# The shell is commented out so that it will run in bash on linux and ksh on aix
|
|
|
|
# !/bin/bash
|
|
|
|
|
2012-01-27 00:23:24 +00:00
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
|
2011-12-19 17:01:18 +00:00
|
|
|
# Common script to make any one the xcat rpms. To build locally, run in the top dir of local svn repository, for example:
|
|
|
|
# ./makerpm xCAT-server
|
|
|
|
# ./makerpm xCAT x86_64
|
2012-01-27 00:23:24 +00:00
|
|
|
# If you want verbose output: export VERBOSE=1
|
2011-12-19 17:01:18 +00:00
|
|
|
|
|
|
|
# set -x
|
|
|
|
|
2013-06-27 07:03:45 +00:00
|
|
|
# Make one of the following rpms: perl-xCAT, xCAT-server, xCAT-client, xCAT-IBMhpc, xCAT-rmc, xCAT-UI, xCAT-test
|
2011-12-19 17:01:18 +00:00
|
|
|
function makenoarch {
|
|
|
|
RPMNAME=$1
|
2013-06-27 07:03:45 +00:00
|
|
|
if [ "$OSNAME" = "AIX" ]; then
|
2011-12-19 17:01:18 +00:00
|
|
|
echo '.svn' > /tmp/xcat-excludes
|
|
|
|
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/$RPMNAME-$VER.tar $RPMNAME
|
|
|
|
gzip -f $RPMROOT/SOURCES/$RPMNAME-$VER.tar
|
|
|
|
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/ppc/$RPMNAME-$VER*rpm
|
2012-01-27 20:40:27 +00:00
|
|
|
echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $EMBEDTXT..."
|
2011-12-19 17:01:18 +00:00
|
|
|
rpm $QUIET -ba $RPMNAME/$RPMNAME.spec
|
|
|
|
RC=$?
|
|
|
|
else # linux
|
2012-01-27 20:40:27 +00:00
|
|
|
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
2011-12-19 17:01:18 +00:00
|
|
|
tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
2013-03-19 14:48:15 +00:00
|
|
|
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
2011-12-19 17:01:18 +00:00
|
|
|
rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz
|
|
|
|
RC=$?
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-27 07:03:45 +00:00
|
|
|
# Make one of the following rpms: xCAT, xCATsn, xCAT-buildkit, xCAT-OpenStack
|
2011-12-19 17:01:18 +00:00
|
|
|
function makexcat {
|
2012-11-02 14:19:47 +00:00
|
|
|
if [ "$OSNAME" != "AIX" -a "$1" != "xCAT-buildkit" -a -z "$2" ]; then
|
2012-01-27 20:40:27 +00:00
|
|
|
echo 'Usage: makerpm <RPMname> <arch> [<embedded-system>]'
|
2011-12-19 17:01:18 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
RPMNAME="$1"
|
|
|
|
|
|
|
|
if [ "$OSNAME" = "AIX" ]; then
|
|
|
|
source=/opt/freeware/src/packages
|
|
|
|
cd `dirname $0`/$RPMNAME
|
|
|
|
echo '.svn' > /tmp/xcat-excludes
|
|
|
|
echo 'upflag' >> /tmp/xcat-excludes
|
|
|
|
|
|
|
|
if [ "$RPMNAME" = "xCAT" ]; then
|
|
|
|
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/postscripts.tar postscripts LICENSE.html
|
|
|
|
gzip -f $RPMROOT/SOURCES/postscripts.tar
|
|
|
|
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/templates.tar templates
|
|
|
|
gzip -f $RPMROOT/SOURCES/templates.tar
|
|
|
|
cp xcat.conf $RPMROOT/SOURCES
|
|
|
|
cp xCATMN $RPMROOT/SOURCES
|
|
|
|
else # xCATsn
|
|
|
|
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/license.tar LICENSE.html
|
|
|
|
gzip -f $RPMROOT/SOURCES/license.tar
|
|
|
|
cp xCATSN $RPMROOT/SOURCES
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/ppc/$RPMNAME-$VER*rpm
|
|
|
|
cd - >/dev/null
|
|
|
|
|
2012-01-27 20:40:27 +00:00
|
|
|
echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $EMBEDTXT..."
|
2011-12-19 17:01:18 +00:00
|
|
|
rpm $QUIET -ba $RPMNAME/$RPMNAME.spec
|
|
|
|
RC=$?
|
|
|
|
else # linux
|
|
|
|
ARCH="$2"
|
2012-11-02 14:19:47 +00:00
|
|
|
TARGET="--target $ARCH"
|
2011-12-19 17:01:18 +00:00
|
|
|
|
|
|
|
if [ "$RPMNAME" = "xCAT" ]; then
|
2012-11-02 14:19:47 +00:00
|
|
|
cd `dirname $0`/$RPMNAME
|
2012-06-12 20:21:39 +00:00
|
|
|
tar --exclude .svn --exclude upflag -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html
|
2011-12-19 17:01:18 +00:00
|
|
|
tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts
|
|
|
|
tar --exclude .svn -czf $RPMROOT/SOURCES/templates.tar.gz templates
|
2013-12-17 07:23:38 +00:00
|
|
|
tar --exclude .svn -czf $RPMROOT/SOURCES/winpostscripts.tar.gz winpostscripts
|
2011-12-19 17:01:18 +00:00
|
|
|
cp xcat.conf $RPMROOT/SOURCES
|
|
|
|
cp xCATMN $RPMROOT/SOURCES
|
2012-11-02 14:19:47 +00:00
|
|
|
cd - >/dev/null
|
|
|
|
elif [ "$RPMNAME" = "xCATsn" ]; then
|
|
|
|
cd `dirname $0`/$RPMNAME
|
2011-12-19 17:01:18 +00:00
|
|
|
tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html
|
|
|
|
cp xcat.conf $RPMROOT/SOURCES
|
|
|
|
cp xCATSN $RPMROOT/SOURCES
|
2012-11-02 14:19:47 +00:00
|
|
|
cd - >/dev/null
|
|
|
|
elif [ "$RPMNAME" = "xCAT-buildkit" ]; then
|
|
|
|
ARCH="noarch"
|
|
|
|
TARGET=""
|
|
|
|
tar --exclude .svn --exclude xCAT-buildkit.spec -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
2013-06-27 07:03:45 +00:00
|
|
|
elif [ "$RPMNAME" = "xCAT-OpenStack" ]; then
|
|
|
|
tar --exclude .svn --exclude xCAT-OpenStack.spec -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
2012-11-02 14:19:47 +00:00
|
|
|
else # do not recognize rpm
|
|
|
|
echo "Unrecognized rpm: $RPMNAME"
|
|
|
|
exit 2
|
2011-12-19 17:01:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm
|
2012-01-27 20:40:27 +00:00
|
|
|
echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..."
|
2012-11-02 14:19:47 +00:00
|
|
|
rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET
|
2011-12-19 17:01:18 +00:00
|
|
|
RC=$?
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Make the xCAT-nbroot-core rpm
|
|
|
|
function makenbroot {
|
|
|
|
if [ -z "$2" ]; then
|
2012-01-27 20:40:27 +00:00
|
|
|
echo 'Usage: makerpm xCAT-nbroot-core <arch> [<embedded-system>]'
|
2011-12-19 17:01:18 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
DIR="xCAT-nbroot"
|
|
|
|
ARCH="$2"
|
|
|
|
RPMNAME="xCAT-nbroot-core-$ARCH"
|
|
|
|
SPEC="xcat-core-nbroot"
|
|
|
|
cd `dirname $0`/$DIR
|
|
|
|
tar --exclude .svn -czf $RPMROOT/SOURCES/xcat-nbrootoverlay.tar.gz -C overlay/ .
|
|
|
|
cp LICENSE.html $RPMROOT/BUILD
|
|
|
|
cp $SPEC.spec $RPMROOT/SOURCES
|
|
|
|
cd - >/dev/null
|
|
|
|
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
2012-01-27 20:40:27 +00:00
|
|
|
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
2011-12-19 17:01:18 +00:00
|
|
|
rpmbuild $QUIET -ba $DIR/$SPEC.spec --target $ARCH
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-02 14:19:47 +00:00
|
|
|
# Make the xCAT-genesis rpm
|
2011-12-19 17:01:18 +00:00
|
|
|
function makegenesis {
|
2012-12-07 18:30:18 +00:00
|
|
|
DIR="xCAT-genesis-builder"
|
2011-12-19 17:01:18 +00:00
|
|
|
RPMNAME="$1"
|
|
|
|
cd `dirname $0`/$DIR
|
|
|
|
tar --exclude .svn -cjf $RPMROOT/SOURCES/$RPMNAME.tar.bz2 .
|
|
|
|
cp LICENSE.html $RPMROOT/BUILD
|
|
|
|
cp $RPMNAME.spec $RPMROOT/SOURCES
|
|
|
|
cd - >/dev/null
|
|
|
|
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
2012-01-27 20:40:27 +00:00
|
|
|
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
2011-12-19 17:01:18 +00:00
|
|
|
rpmbuild $QUIET -ba $DIR/$RPMNAME.spec
|
|
|
|
}
|
2012-12-07 18:30:18 +00:00
|
|
|
function makegenesisscripts {
|
|
|
|
DIR="xCAT-genesis-scripts"
|
|
|
|
if [ -z "$2" ]; then
|
|
|
|
echo 'Usage: makerpm xCAT-genesis-scripts <arch> [<embedded-system>]'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
RPMNAME="$1"
|
|
|
|
ARCH="$2"
|
2013-01-09 22:48:54 +00:00
|
|
|
TARGET="--target $ARCH"
|
2012-12-07 19:22:16 +00:00
|
|
|
cd `dirname $0`/
|
|
|
|
tar --exclude .svn -cjf $RPMROOT/SOURCES/$RPMNAME.tar.bz2 $DIR
|
2013-01-07 15:29:09 +00:00
|
|
|
cp $DIR/LICENSE.html $RPMROOT/BUILD
|
|
|
|
cp $DIR/$RPMNAME.spec $RPMROOT/SOURCES
|
2012-12-07 18:30:18 +00:00
|
|
|
cd - >/dev/null
|
|
|
|
rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm
|
|
|
|
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
2013-01-09 22:48:54 +00:00
|
|
|
rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET
|
2012-12-07 18:30:18 +00:00
|
|
|
}
|
2011-12-19 17:01:18 +00:00
|
|
|
|
|
|
|
|
2012-01-27 20:40:27 +00:00
|
|
|
# Export the name of the embedded system we are building for
|
|
|
|
function exportEmbed {
|
2012-01-27 00:23:24 +00:00
|
|
|
if [ -n "$1" ]; then
|
|
|
|
export "$1=1"
|
2012-01-27 20:40:27 +00:00
|
|
|
EMBEDTXT="for $1 "
|
2012-01-27 00:23:24 +00:00
|
|
|
else
|
2012-01-27 20:40:27 +00:00
|
|
|
EMBEDTXT=""
|
2012-01-27 00:23:24 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2011-12-19 17:01:18 +00:00
|
|
|
|
|
|
|
# Main code....
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2012-01-27 20:40:27 +00:00
|
|
|
echo 'Usage: makerpm <RPMname> [<arch>] [<embedded-system>]'
|
2011-12-19 17:01:18 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
OSNAME=$(uname)
|
|
|
|
VER=`cat Version`
|
|
|
|
if [ "$VERBOSE" = "1" -o "$VERBOSE" = "yes" ];then
|
|
|
|
QUIET=""
|
|
|
|
else
|
|
|
|
QUIET="--quiet"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$OSNAME" = "AIX" ]; then
|
|
|
|
RPMROOT=/opt/freeware/src/packages
|
|
|
|
else # linux
|
|
|
|
rpmbuild --version > /dev/null
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
echo "Error: rpmbuild does not appear to be installed or working."
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec`
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
echo "Error: Could not determine rpmbuild's root directory."
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2013-06-27 07:03:45 +00:00
|
|
|
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" -o "$1" = "xCAT-OpenStack" ]; then
|
2012-01-27 20:40:27 +00:00
|
|
|
exportEmbed $3
|
2012-01-27 00:23:24 +00:00
|
|
|
makexcat $1 $2
|
2011-12-19 17:01:18 +00:00
|
|
|
elif [ "$1" = "xCAT-nbroot" -o "$1" = "xCAT-nbroot-core" ]; then
|
2012-01-27 20:40:27 +00:00
|
|
|
exportEmbed $3
|
2011-12-19 17:01:18 +00:00
|
|
|
makenbroot xCAT-nbroot-core $2
|
|
|
|
elif [ "$1" = "xCAT-genesis-builder" ]; then
|
2013-01-09 22:48:54 +00:00
|
|
|
exportEmbed $2
|
|
|
|
makegenesis $1
|
2012-12-07 18:30:18 +00:00
|
|
|
elif [ "$1" = "xCAT-genesis-scripts" ]; then
|
|
|
|
exportEmbed $3
|
|
|
|
makegenesisscripts $1 $2
|
2011-12-19 17:01:18 +00:00
|
|
|
else # must be one of the noarch rpms
|
2012-01-27 20:40:27 +00:00
|
|
|
exportEmbed $2
|
2012-01-27 00:23:24 +00:00
|
|
|
makenoarch $1
|
2011-12-19 17:01:18 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit $RC
|