2010-06-11 18:41:56 +00:00
|
|
|
# The shell is commented out so that it will run in bash on linux and ksh on aix
|
|
|
|
# !/bin/sh
|
2009-02-20 16:06:26 +00:00
|
|
|
# Package up all the xCAT open source dependencies, setting up yum repos and
|
|
|
|
# also tar it all up. This assumes that individual rpms have already been built for
|
|
|
|
# all relevant architectures from the src & spec files in svn.
|
|
|
|
|
|
|
|
# When running this script to package xcat-dep:
|
2009-11-10 20:46:34 +00:00
|
|
|
# - You need to install gsa-client on the build machine.
|
|
|
|
# - You probably want to put root's pub key from the build machine onto sourceforge for
|
|
|
|
# the upload user listed below, so you don't have to keep entering pw's. You can do this
|
|
|
|
# at https://sourceforge.net/account/ssh
|
|
|
|
# - Also make sure createrepo is installed on the build machine
|
|
|
|
|
|
|
|
# Usage: builddep.sh [attr=value attr=value ...]
|
|
|
|
# DESTDIR=<dir> - the dir to place the dep tarball in. The default is ../../../xcat-dep, relative
|
|
|
|
# to where this script is located.
|
|
|
|
# UP=0 or UP=1 - override the default upload behavior
|
2011-12-19 17:01:18 +00:00
|
|
|
# FRSYUM=1 - put the directory of individual rpms in the FRS area instead of project web area.
|
2011-12-21 12:21:31 +00:00
|
|
|
# VERBOSE=1 - to see lots of verbose output
|
2009-02-20 16:06:26 +00:00
|
|
|
|
|
|
|
# you can change this if you need to
|
|
|
|
UPLOADUSER=bp-sawyers
|
|
|
|
|
2011-12-19 17:01:18 +00:00
|
|
|
FRS=/home/frs/project/x/xc/xcat
|
2010-06-11 18:41:56 +00:00
|
|
|
OSNAME=$(uname)
|
|
|
|
|
2011-12-21 12:21:31 +00:00
|
|
|
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
|
|
|
|
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 [ "$VERBOSE" = "1" -o "$VERBOSE" = "yes" ]; then
|
|
|
|
set -x
|
|
|
|
VERBOSEMODE=1
|
|
|
|
fi
|
|
|
|
|
2010-06-11 18:41:56 +00:00
|
|
|
if [ "$OSNAME" == "AIX" ]; then
|
|
|
|
GSA=/gsa/pokgsa/projects/x/xcat/build/aix/xcat-dep
|
|
|
|
else
|
|
|
|
GSA=/gsa/pokgsa/projects/x/xcat/build/linux/xcat-dep
|
|
|
|
export HOME=/root # This is so rpm and gpg will know home, even in sudo
|
|
|
|
fi
|
2009-11-10 20:46:34 +00:00
|
|
|
|
2011-12-19 17:01:18 +00:00
|
|
|
# this is needed only when we are transitioning the yum over to frs
|
2011-12-21 12:21:31 +00:00
|
|
|
YUMREPOURL1="http://xcat.sourceforge.net/yum"
|
|
|
|
YUMREPOURL2="https://sourceforge.net/projects/xcat/files/yum"
|
2011-12-19 17:01:18 +00:00
|
|
|
if [ "$FRSYUM" = 1 ]; then
|
|
|
|
YUMDIR=$FRS
|
2011-12-21 12:21:31 +00:00
|
|
|
YUMREPOURL="$YUMREPOURL2"
|
2011-12-19 17:01:18 +00:00
|
|
|
else
|
|
|
|
YUMDIR=htdocs
|
2011-12-21 12:21:31 +00:00
|
|
|
YUMREPOURL="$YUMREPOURL1"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$VERBOSEMODE" ]; then
|
|
|
|
GREP=grep
|
|
|
|
else
|
|
|
|
GREP="grep -q"
|
2011-12-19 17:01:18 +00:00
|
|
|
fi
|
|
|
|
|
2009-11-10 20:46:34 +00:00
|
|
|
if [ ! -d $GSA ]; then
|
|
|
|
echo "builddep: It appears that you do not have gsa installed to access the xcat-dep pkgs."
|
2009-02-20 16:06:26 +00:00
|
|
|
exit 1;
|
2008-03-04 18:10:05 +00:00
|
|
|
fi
|
2009-11-10 21:24:29 +00:00
|
|
|
cd `dirname $0`
|
|
|
|
XCATCOREDIR=`/bin/pwd`
|
2009-11-10 20:46:34 +00:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
|
|
|
DESTDIR=../../../xcat-dep
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Sync from the GSA master copy of the dep rpms
|
|
|
|
mkdir -p $DESTDIR/xcat-dep
|
2011-12-21 12:21:31 +00:00
|
|
|
echo "Syncing RPMs from $GSA/ to $DESTDIR/xcat-dep ..."
|
2009-11-10 20:46:34 +00:00
|
|
|
rsync -ilrtpu --delete $GSA/ $DESTDIR/xcat-dep
|
2010-06-11 18:41:56 +00:00
|
|
|
cd $DESTDIR/xcat-dep
|
2009-11-10 20:46:34 +00:00
|
|
|
|
2010-06-11 18:41:56 +00:00
|
|
|
if [ "$OSNAME" != "AIX" ]; then
|
|
|
|
# Get gpg keys in place
|
|
|
|
mkdir -p $HOME/.gnupg
|
|
|
|
for i in pubring.gpg secring.gpg trustdb.gpg; do
|
|
|
|
if [ ! -f $HOME/.gnupg/$i ] || [ `wc -c $HOME/.gnupg/$i|cut -f 1 -d' '` == 0 ]; then
|
|
|
|
rm -f $HOME/.gnupg/$i
|
|
|
|
cp $GSA/../keys/$i $HOME/.gnupg
|
|
|
|
chmod 600 $HOME/.gnupg/$i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Tell rpm to use gpg to sign
|
|
|
|
MACROS=$HOME/.rpmmacros
|
|
|
|
if ! $GREP -q '%_signature gpg' $MACROS 2>/dev/null; then
|
|
|
|
echo '%_signature gpg' >> $MACROS
|
|
|
|
fi
|
|
|
|
if ! $GREP -q '%_gpg_name' $MACROS 2>/dev/null; then
|
|
|
|
echo '%_gpg_name Jarrod Johnson' >> $MACROS
|
2009-11-10 20:46:34 +00:00
|
|
|
fi
|
|
|
|
|
2010-06-11 18:41:56 +00:00
|
|
|
# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal.
|
2011-12-21 12:21:31 +00:00
|
|
|
echo "Signing RPMs..."
|
2011-12-22 10:56:44 +00:00
|
|
|
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
2010-06-11 18:41:56 +00:00
|
|
|
|
|
|
|
# Create the repodata dirs
|
2011-12-21 12:21:31 +00:00
|
|
|
echo "Creating repodata directories..."
|
2010-06-11 18:41:56 +00:00
|
|
|
for i in `find -mindepth 2 -maxdepth 2 -type d `; do
|
2011-12-21 12:21:31 +00:00
|
|
|
if [ -n "$VERBOSEMODE" ]; then
|
|
|
|
createrepo $i
|
|
|
|
else
|
|
|
|
createrepo $i >/dev/null
|
|
|
|
fi
|
2010-06-11 18:41:56 +00:00
|
|
|
rm -f $i/repodata/repomd.xml.asc
|
|
|
|
gpg -a --detach-sign $i/repodata/repomd.xml
|
|
|
|
if [ ! -f $i/repodata/repomd.xml.key ]; then
|
|
|
|
cp $GSA/../keys/repomd.xml.key $i/repodata
|
|
|
|
fi
|
|
|
|
done
|
2011-12-21 12:21:31 +00:00
|
|
|
|
|
|
|
# Modify xCAT-dep.repo files to point to the correct place
|
|
|
|
if [ "$FRSYUM" = 1 ]; then
|
|
|
|
newurl="$YUMREPOURL2"
|
|
|
|
oldurl="$YUMREPOURL1"
|
|
|
|
else
|
|
|
|
newurl="$YUMREPOURL1"
|
|
|
|
oldurl="$YUMREPOURL2"
|
|
|
|
fi
|
|
|
|
sed -i -e "s|=$oldurl|=$newurl|g" `find . -name "xCAT-dep.repo" `
|
2008-03-04 18:10:05 +00:00
|
|
|
fi
|
2009-02-20 16:06:26 +00:00
|
|
|
|
2010-06-11 18:41:56 +00:00
|
|
|
if [ "$OSNAME" == "AIX" ]; then
|
|
|
|
# Build the instoss file
|
2011-12-21 12:21:31 +00:00
|
|
|
|
2010-06-11 18:41:56 +00:00
|
|
|
cat >instoss << 'EOF'
|
|
|
|
#!/bin/ksh
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
# xCAT on AIX - prerequisite install script
|
|
|
|
cd `dirname $0`
|
2010-06-23 01:02:15 +00:00
|
|
|
PERLVER=`perl -v|grep 'This is perl'|cut -d' ' -f 4`
|
|
|
|
if [ "$PERLVER" == "v5.8.2" ]; then
|
|
|
|
OSVER='5.3'
|
2010-07-14 18:50:52 +00:00
|
|
|
elif [ "$PERLVER" == "v5.8.8" ]; then
|
2010-06-23 01:02:15 +00:00
|
|
|
OSVER='6.1'
|
2010-07-14 18:50:52 +00:00
|
|
|
elif [ "$PERLVER" == "v5.10.1" ]; then
|
|
|
|
OSVER='7.1'
|
|
|
|
else
|
|
|
|
echo "Error: the perl version of '$PERLVER' is not one that instoss understands. Exiting..."
|
|
|
|
exit 2
|
2010-06-23 01:02:15 +00:00
|
|
|
fi
|
2010-07-13 11:50:36 +00:00
|
|
|
cd $OSVER
|
2010-07-14 18:50:52 +00:00
|
|
|
# Have to install rpms 1 at a time, since some may be already installed.
|
2010-07-13 19:31:34 +00:00
|
|
|
# The only interdependency between the dep rpms so far is that net-snmp requires bash
|
2011-04-21 13:53:36 +00:00
|
|
|
# pyodbc is dependent on unixODBC
|
|
|
|
rpm -Uvh unixODBC*
|
2011-05-08 05:32:32 +00:00
|
|
|
for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps'`; do
|
2010-07-14 20:07:57 +00:00
|
|
|
if [ "$i" == "perl-Net-DNS-0.66-1.aix5.3.ppc.rpm" ]; then
|
|
|
|
opts="--nodeps"
|
|
|
|
else
|
|
|
|
opts=""
|
|
|
|
fi
|
2010-07-29 11:36:38 +00:00
|
|
|
# this next if stmt means: if i does not start with perl-DBD-DB2
|
2011-02-09 20:44:29 +00:00
|
|
|
#if [ "${i#perl-DBD-DB2}" == "$i" ]; then
|
2010-07-29 11:36:38 +00:00
|
|
|
echo rpm -Uvh $opts $i
|
|
|
|
rpm -Uvh $opts $i
|
2011-02-09 20:44:29 +00:00
|
|
|
#fi
|
2010-07-13 19:31:34 +00:00
|
|
|
done
|
2010-07-13 11:50:36 +00:00
|
|
|
# don't try to install tcl, tk, or expect if they are already installed!
|
|
|
|
lslpp -l | grep expect.base > /dev/null 2>&1
|
|
|
|
if [ $? -gt 0 ]; then
|
2010-07-14 18:50:52 +00:00
|
|
|
if [ "$OSVER" == "5.3" ]; then
|
2010-07-14 20:07:57 +00:00
|
|
|
for i in tcl-*.rpm tk-*.rpm expect-*.rpm; do
|
|
|
|
echo rpm -Uvh $i
|
|
|
|
rpm -Uvh $i
|
|
|
|
done
|
2010-07-14 18:50:52 +00:00
|
|
|
else
|
|
|
|
echo "The expect.base, tcl.base, and tk.base filesets must also be installed before installing the xCAT RPMs from xcat-core."
|
2010-07-13 11:50:36 +00:00
|
|
|
fi
|
|
|
|
fi
|
2010-07-14 20:07:57 +00:00
|
|
|
EOF
|
2011-12-21 12:21:31 +00:00
|
|
|
# end of instoss file content
|
2010-07-14 20:07:57 +00:00
|
|
|
|
2010-06-11 18:41:56 +00:00
|
|
|
|
|
|
|
chmod +x instoss
|
|
|
|
fi
|
2009-02-20 16:06:26 +00:00
|
|
|
|
|
|
|
# Get the permissions correct. Have to have all dirs/files with a group of xcat
|
|
|
|
# and have them writeable by group, so any member of the xcat can build.
|
2010-06-11 18:41:56 +00:00
|
|
|
if [ "$OSNAME" == "AIX" ]; then
|
2011-12-21 12:21:31 +00:00
|
|
|
if ! lsgroup xcat >/dev/null 2>&1; then
|
|
|
|
mkgroup xcat
|
|
|
|
fi
|
2010-06-11 18:41:56 +00:00
|
|
|
else
|
2011-12-21 12:21:31 +00:00
|
|
|
if ! $GREP xcat /etc/group; then
|
|
|
|
groupadd xcat
|
|
|
|
fi
|
2010-06-11 18:41:56 +00:00
|
|
|
fi
|
2009-02-20 16:06:26 +00:00
|
|
|
chgrp -R xcat *
|
|
|
|
chmod -R g+w *
|
|
|
|
|
|
|
|
# Build the tarball
|
2010-05-18 15:41:06 +00:00
|
|
|
#VER=`cat $XCATCOREDIR/Version`
|
2009-02-20 20:54:59 +00:00
|
|
|
cd ..
|
2011-12-21 12:21:31 +00:00
|
|
|
if [ -n "$VERBOSEMODE" ]; then
|
|
|
|
verbosetar="-v"
|
|
|
|
else
|
|
|
|
verbosetar=""
|
|
|
|
fi
|
2010-06-11 18:41:56 +00:00
|
|
|
if [ "$OSNAME" == "AIX" ]; then
|
|
|
|
DFNAME=dep-aix-`date +%Y%m%d%H%M`.tar.gz
|
2011-12-21 12:21:31 +00:00
|
|
|
echo "Creating $DFNAME ..."
|
|
|
|
tar $verbosetar -cf ${DFNAME%.gz} xcat-dep
|
2010-06-11 18:41:56 +00:00
|
|
|
rm -f $DFNAME
|
|
|
|
gzip ${DFNAME%.gz}
|
|
|
|
else
|
|
|
|
DFNAME=xcat-dep-`date +%Y%m%d%H%M`.tar.bz2
|
2011-12-21 12:21:31 +00:00
|
|
|
echo "Creating $DFNAME ..."
|
|
|
|
tar $verbosetar -jcf $DFNAME xcat-dep
|
2010-06-11 18:41:56 +00:00
|
|
|
fi
|
2009-02-20 20:54:59 +00:00
|
|
|
cd xcat-dep
|
2008-03-04 18:10:05 +00:00
|
|
|
|
2009-11-10 20:46:34 +00:00
|
|
|
if [ "$UP" == 0 ]; then
|
2008-03-04 18:10:05 +00:00
|
|
|
exit 0;
|
|
|
|
fi
|
2009-02-20 16:06:26 +00:00
|
|
|
|
2010-06-11 18:41:56 +00:00
|
|
|
if [ "$OSNAME" == "AIX" ]; then
|
|
|
|
YUM=aix
|
|
|
|
FRSDIR='2.x_AIX'
|
|
|
|
else
|
|
|
|
YUM=yum
|
|
|
|
FRSDIR='2.x_Linux'
|
|
|
|
fi
|
|
|
|
|
2009-07-23 15:58:16 +00:00
|
|
|
# Upload the dir structure to SF yum area. Currently we do not have it preserving permissions
|
2009-02-20 16:06:26 +00:00
|
|
|
# because that gives errors when different users try to do it.
|
2011-12-19 17:01:18 +00:00
|
|
|
i=0
|
2011-12-21 12:21:31 +00:00
|
|
|
if [ "$FRSYUM" = 1 ]; then
|
|
|
|
links="-L" # FRS does not support rsyncing sym links
|
|
|
|
else
|
|
|
|
links="-l"
|
|
|
|
fi
|
|
|
|
echo "Uploading RPMs to $YUMDIR/$YUM/xcat-dep/ ..."
|
|
|
|
while [ $((i++)) -lt 10 ] && ! rsync $links -ruv --delete * $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/xcat-dep/
|
2009-08-13 19:07:34 +00:00
|
|
|
do : ; done
|
2009-02-20 16:06:26 +00:00
|
|
|
|
2009-08-13 19:07:34 +00:00
|
|
|
# Upload the tarball to the SF FRS Area
|
2011-12-19 17:01:18 +00:00
|
|
|
i=0
|
2011-12-21 12:21:31 +00:00
|
|
|
echo "Uploading $DFNAME to $FRS/xcat-dep/$FRSDIR/ ..."
|
2011-12-19 17:01:18 +00:00
|
|
|
while [ $((i++)) -lt 10 ] && ! rsync -v ../$DFNAME $UPLOADUSER,xcat@web.sourceforge.net:$FRS/xcat-dep/$FRSDIR/
|
2009-08-13 19:07:34 +00:00
|
|
|
do : ; done
|