2012-04-10 21:11:28 +00:00
|
|
|
#!/bin/bash
|
|
|
|
###########
|
|
|
|
#
|
|
|
|
# This script call make<package>deb and create the deb packages
|
|
|
|
# for xCAT
|
|
|
|
#
|
|
|
|
# Author: Arif Ali <aali@ocf.co.uk>
|
|
|
|
#
|
|
|
|
# Original Work taken from the xcat-core repo done by Leonardo
|
|
|
|
#
|
|
|
|
# Input:
|
|
|
|
#
|
2013-02-09 06:13:37 +00:00
|
|
|
# $1 is the xCAT_genesis_build directory path
|
|
|
|
# $2 is the xCAT_genesis_base rpm path
|
|
|
|
#
|
|
|
|
# the build target path is ../../debs, this path can not changed, because the build-ubuntu script will use this fix path
|
2012-04-10 21:11:28 +00:00
|
|
|
#
|
|
|
|
############
|
2013-02-09 06:13:37 +00:00
|
|
|
function pingusage()
|
|
|
|
{
|
2013-06-26 09:56:50 +00:00
|
|
|
printf "Usage: [BUILDPKGS=\"pkgname1 pkgname2 ...\"] %s <xCAT_genesis_build directory path> <xCAT_genesis_base rpm path>] \n" $(basename $0) >&2
|
2013-02-09 06:13:37 +00:00
|
|
|
}
|
2012-04-10 21:11:28 +00:00
|
|
|
|
|
|
|
function makedeb {
|
|
|
|
SRC_ROOT=$1
|
|
|
|
|
|
|
|
#
|
|
|
|
# Make DEBs
|
|
|
|
#
|
|
|
|
# build perl-xCAT - deps are libsoap-lite-perl, libdigest-sha1-perl, libdbi-perl
|
|
|
|
#
|
|
|
|
|
|
|
|
find $SRC_ROOT -maxdepth 2 -name make_deb.sh -type f | while read DEBIAN_SCRIPT
|
|
|
|
do
|
|
|
|
DIR=`echo ${DEBIAN_SCRIPT} | sed -e 's/[/]make_deb.sh$//'`
|
|
|
|
cd ${DIR}
|
|
|
|
chmod a+x make_deb.sh
|
|
|
|
./make_deb.sh
|
|
|
|
cd -
|
|
|
|
RC=$?
|
|
|
|
if [ ${RC} -gt 0 ]
|
|
|
|
then
|
|
|
|
echo "Warning: ${DIR} failed exit code ${RC}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2013-02-09 06:13:37 +00:00
|
|
|
#check parameters
|
|
|
|
if [ $# -lt 2 ];then
|
|
|
|
pingusage
|
|
|
|
exit 2
|
|
|
|
fi
|
2012-04-10 21:11:28 +00:00
|
|
|
|
2013-02-09 06:13:37 +00:00
|
|
|
old_pwd=`pwd`
|
|
|
|
curdir=`dirname $0`
|
|
|
|
#did some prepare for the xcat-genesis
|
|
|
|
echo "prepare building gensis_base_amd64 as a special case"
|
|
|
|
|
|
|
|
#copy the debian_dir and rpm for xcat-genesia-base to the tem directory
|
|
|
|
mkdir -p $curdir/genesis_tmp/genesis-base-amd64
|
|
|
|
cp -rL ${1}/debian $curdir/genesis_tmp/genesis-base-amd64
|
|
|
|
cp ${2} $curdir/genesis_tmp/genesis-base-amd64
|
|
|
|
cd $curdir
|
|
|
|
cat << __EOF__ > genesis_tmp/make_deb.sh
|
|
|
|
cd genesis-base-amd64/
|
|
|
|
rpm2cpio *.rpm | cpio -id
|
|
|
|
rm -f *.rpm
|
2013-02-20 04:23:39 +00:00
|
|
|
dpkg-buildpackage -uc -us
|
2013-02-09 06:13:37 +00:00
|
|
|
cd -
|
|
|
|
__EOF__
|
|
|
|
|
|
|
|
#update to the loatest code
|
|
|
|
svn --quiet update
|
2013-06-26 09:56:50 +00:00
|
|
|
packages=""
|
|
|
|
if [ $BUILDPKGS ];then
|
|
|
|
packages=$BUILDPKGS
|
|
|
|
else
|
|
|
|
packages=`find . -maxdepth 2 -name make_deb.sh | cut -d/ -f 2 | xargs`
|
|
|
|
fi
|
2012-09-28 06:16:03 +00:00
|
|
|
#fix 'all warnings being treated as errors'
|
|
|
|
export NO_WERROR=1
|
|
|
|
|
2012-04-10 21:11:28 +00:00
|
|
|
# build all debian packages
|
2013-02-09 06:13:37 +00:00
|
|
|
#for file in `echo $packages`
|
2012-04-10 21:11:28 +00:00
|
|
|
for file in `echo $packages`
|
|
|
|
do
|
|
|
|
makedeb $file $PKG_LOCATION "$BUILD_STRING" $VERSION
|
|
|
|
done
|
|
|
|
|
2013-02-09 06:13:37 +00:00
|
|
|
if [ ! -d ../../debs ]; then
|
|
|
|
mkdir -p ../../debs/
|
2012-04-10 21:11:28 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
for file in `echo $packages`
|
|
|
|
do
|
2013-02-09 06:13:37 +00:00
|
|
|
mv $file/*.deb ../../debs/
|
2012-04-10 21:11:28 +00:00
|
|
|
done
|
|
|
|
|
2013-02-09 06:13:37 +00:00
|
|
|
rm -rf genesis_tmp
|
2012-04-10 21:11:28 +00:00
|
|
|
exit 0
|