2014-03-25 09:45:11 +00:00
|
|
|
#######################################################################
|
|
|
|
#build script for local usage
|
|
|
|
#used for Linux/AIX/Ubuntu
|
|
|
|
#
|
|
|
|
###########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
OSNAME=$(uname)
|
|
|
|
NAMEALL=$(uname -a)
|
|
|
|
|
2014-04-02 03:58:53 +00:00
|
|
|
for i in $*; do
|
|
|
|
# upper case the variable name
|
|
|
|
varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2`
|
|
|
|
export $varstring
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$CURDIR" ]; then
|
|
|
|
echo "get current directory!"
|
|
|
|
CURDIR=$(pwd)
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "CURDIR is $CURDIR"
|
2014-03-25 09:45:11 +00:00
|
|
|
echo "OSNAME is $OSNAME!"
|
|
|
|
echo "NAMEALL is $NAMEALL"
|
|
|
|
|
2014-04-23 09:28:15 +00:00
|
|
|
grep -i 'SUSE' /etc/issue
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This is a SUSE system!"
|
|
|
|
OS="SUSE";
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2014-03-28 05:21:51 +00:00
|
|
|
ls $CURDIR/makerpm
|
2014-03-25 09:45:11 +00:00
|
|
|
|
|
|
|
if [ $? -gt 0 ]; then
|
|
|
|
echo "Error:no repo exist, exit 1."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Get a lock, so can not do 2 builds at once
|
|
|
|
exec 8>/var/lock/xcatbld.lock
|
|
|
|
if ! flock -n 8; then
|
|
|
|
echo "Can't get lock /var/lock/xcatbld.lock. Someone else must be doing a build right now. Exiting...."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-04-02 03:58:53 +00:00
|
|
|
#delete old package if there is
|
2014-03-28 05:21:51 +00:00
|
|
|
rm -rf $CURDIR/build/
|
2014-04-02 03:58:53 +00:00
|
|
|
cd $CURDIR
|
2014-03-25 09:45:11 +00:00
|
|
|
|
|
|
|
echo "==============================================="
|
|
|
|
echo $NAMEALL | egrep "Ubuntu"
|
|
|
|
|
|
|
|
#Check if it is an Ubuntu system
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
|
|
|
|
echo "This is an Ubuntu system"
|
|
|
|
pkg_type="snap"
|
|
|
|
build_string="Snap_Build"
|
|
|
|
cur_date=`date +%Y%m%d`
|
|
|
|
short_ver=`cat Version|cut -d. -f 1,2`
|
|
|
|
pkg_version="${short_ver}-${pkg_type}${cur_date}"
|
|
|
|
|
2014-03-28 05:21:51 +00:00
|
|
|
mkdir -p $CURDIR/build
|
2014-03-25 09:45:11 +00:00
|
|
|
|
|
|
|
for rpmname in xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test; do
|
|
|
|
rpmname_low=`echo $rpmname | tr '[A-Z]' '[a-z]'`
|
|
|
|
echo "============================================"
|
|
|
|
echo "$rpmname_low"
|
|
|
|
cd $rpmname
|
|
|
|
dch -v $pkg_version -b -c debian/changelog $build_string
|
|
|
|
dpkg-buildpackage -uc -us
|
|
|
|
rc=$?
|
|
|
|
if [ $rc -gt 0 ]; then
|
|
|
|
echo "Error: $rpmname build package failed exit code $rc"
|
|
|
|
fi
|
|
|
|
cd -
|
2014-04-02 03:58:53 +00:00
|
|
|
mv ${rpmname_low}* $CURDIR/build
|
2014-03-25 09:45:11 +00:00
|
|
|
|
|
|
|
done
|
|
|
|
#delete all files except .deb file
|
2014-03-28 05:21:51 +00:00
|
|
|
find $CURDIR/build/* ! -name *.deb | xargs rm -f
|
2014-03-25 09:45:11 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
#This is not an Ubuntu system
|
|
|
|
echo "This is an $OSNAME system"
|
|
|
|
|
2014-04-23 09:28:15 +00:00
|
|
|
if [ "$OS" = "SUSE" ]; then
|
|
|
|
rm -rf /usr/src/packages/RPMS/noarch/*
|
|
|
|
rm -rf /usr/src/packages/RPMS/x86_64/*
|
|
|
|
rm -rf /usr/src/packages/RPMS/ppc64/*
|
|
|
|
else
|
|
|
|
rm -rf /root/rpmbuild/RPMS/noarch/*
|
|
|
|
rm -rf /root/rpmbuild/RPMS/x86_64/*
|
|
|
|
rm -rf /root/rpmbuild/RPMS/ppc64/*
|
|
|
|
fi
|
|
|
|
|
2014-03-28 05:21:51 +00:00
|
|
|
mkdir -p $CURDIR/build/
|
2014-04-02 03:58:53 +00:00
|
|
|
|
|
|
|
#always build perl-xCAT
|
|
|
|
$CURDIR/makerpm perl-xCAT
|
|
|
|
|
|
|
|
|
2014-03-25 09:45:11 +00:00
|
|
|
# Build the rest of the noarch rpms
|
|
|
|
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-test xCAT-buildkit; do
|
|
|
|
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi
|
2014-04-02 03:58:53 +00:00
|
|
|
$CURDIR/makerpm $rpmname
|
2014-03-25 09:45:11 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
#build xCAT-genesis-scripts if it is x86_64 platform
|
|
|
|
ARCH=$(uname -p)
|
|
|
|
if [ "$ARCH" = "x64_64" ]; then
|
2014-04-02 03:58:53 +00:00
|
|
|
$CURDIR/makerpm xCAT-genesis-scripts x86_64
|
2014-11-10 02:44:00 +00:00
|
|
|
else
|
|
|
|
$CURDIR/makerpm xCAT-genesis-scripts ppc64
|
2014-03-25 09:45:11 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Build the xCAT and xCATsn rpms for all platforms
|
|
|
|
for rpmname in xCAT xCATsn; do
|
|
|
|
if [ "$OSNAME" = "AIX" ]; then
|
2014-04-02 03:58:53 +00:00
|
|
|
$CURDIR/makerpm $rpmname
|
2014-03-25 09:45:11 +00:00
|
|
|
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
|
|
|
else
|
|
|
|
for arch in x86_64 ppc64 s390x; do
|
2014-04-02 03:58:53 +00:00
|
|
|
$CURDIR/makerpm $rpmname $arch
|
2014-03-25 09:45:11 +00:00
|
|
|
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2014-04-23 09:28:15 +00:00
|
|
|
if [ "$OS" = "SUSE" ]; then
|
|
|
|
cp /usr/src/packages/RPMS/noarch/* $CURDIR/build/
|
|
|
|
cp /usr/src/packages/RPMS/x86_64/* $CURDIR/build/
|
|
|
|
cp /usr/src/packages/RPMS/ppc64/* $CURDIR/build/
|
|
|
|
else
|
|
|
|
cp /root/rpmbuild/RPMS/noarch/* $CURDIR/build/
|
|
|
|
cp /root/rpmbuild/RPMS/x86_64/* $CURDIR/build/
|
|
|
|
cp /root/rpmbuild/RPMS/ppc64/* $CURDIR/build/
|
|
|
|
fi
|
2014-03-28 05:21:51 +00:00
|
|
|
|
|
|
|
#begin to create repo for redhat platform
|
|
|
|
|
2014-04-22 10:01:23 +00:00
|
|
|
grep -i 'Red' /etc/issue;
|
|
|
|
if [ "$OSNAME" != "AIX" -a $? -eq 0 ]; then
|
2014-03-28 05:21:51 +00:00
|
|
|
cat >$CURDIR/build/xCAT-core.repo << EOF
|
|
|
|
[xcat-2-core]
|
|
|
|
name=xCAT 2 Core packages
|
2014-04-02 03:58:53 +00:00
|
|
|
baseurl=file://$CURDIR/build
|
2014-03-28 05:21:51 +00:00
|
|
|
enabled=1
|
2014-04-02 03:58:53 +00:00
|
|
|
gpgcheck=0
|
2014-03-28 05:21:51 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
cp $CURDIR/build/xCAT-core.repo /etc/yum.repos.d/
|
2014-06-27 08:28:25 +00:00
|
|
|
createrepo $CURDIR/build
|
2014-04-23 09:28:15 +00:00
|
|
|
else
|
|
|
|
rm -f /etc/zypp/repos.d/xCAT-core.repo
|
|
|
|
zypper ar file://$CURDIR/build xCAT-core
|
2014-03-28 05:21:51 +00:00
|
|
|
fi
|
2014-03-25 09:45:11 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|