Support aix in the script that builds the deps

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6443 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
bp-sawyers 2010-06-11 18:41:56 +00:00
parent b833d8d16c
commit 36a9947307

View File

@ -1,4 +1,5 @@
#!/bin/sh
# The shell is commented out so that it will run in bash on linux and ksh on aix
# !/bin/sh
# 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.
@ -18,12 +19,22 @@
# you can change this if you need to
UPLOADUSER=bp-sawyers
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
OSNAME=$(uname)
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
fi
if [ "$OSNAME" != "AIX" ]; then
export HOME=/root # This is so rpm and gpg will know home, even in sudo
fi
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
for i in $*; do
declare `echo $i|cut -d '=' -f 1`=`echo $i|cut -d '=' -f 2`
#declare `echo $i|cut -d '=' -f 1`=`echo $i|cut -d '=' -f 2`
export $i
done
if [ ! -d $GSA ]; then
@ -40,63 +51,99 @@ fi
# Sync from the GSA master copy of the dep rpms
mkdir -p $DESTDIR/xcat-dep
rsync -ilrtpu --delete $GSA/ $DESTDIR/xcat-dep
# 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
fi
# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal.
cd $DESTDIR/xcat-dep
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'`
# Create the repodata dirs
for i in `find -mindepth 2 -maxdepth 2 -type d `; do
createrepo $i
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
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
done
if ! $GREP -q '%_gpg_name' $MACROS 2>/dev/null; then
echo '%_gpg_name Jarrod Johnson' >> $MACROS
fi
# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal.
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'`
# Create the repodata dirs
for i in `find -mindepth 2 -maxdepth 2 -type d `; do
createrepo $i
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
fi
if [ "$OSNAME" == "AIX" ]; then
# Build the instoss file
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`
SHORTVER=`oslevel|cut -d. -f 1,2`
rpm -Uvh $SHORTVER/*.rpm
EOF
chmod +x instoss
fi
# 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.
if [ "$OSNAME" == "AIX" ]; then
mkgroup xcat 2>/dev/null
else
groupadd -f xcat
fi
chgrp -R xcat *
chmod -R g+w *
# Build the tarball
#VER=`cat $XCATCOREDIR/Version`
DFNAME=xcat-dep-`date +%Y%m%d%H%M`.tar.bz2
cd ..
tar jcvf $DFNAME xcat-dep
if [ "$OSNAME" == "AIX" ]; then
DFNAME=dep-aix-`date +%Y%m%d%H%M`.tar.gz
tar -cvf ${DFNAME%.gz} xcat-dep
rm -f $DFNAME
gzip ${DFNAME%.gz}
else
DFNAME=xcat-dep-`date +%Y%m%d%H%M`.tar.bz2
tar -jcvf $DFNAME xcat-dep
fi
cd xcat-dep
if [ "$UP" == 0 ]; then
exit 0;
fi
if [ "$OSNAME" == "AIX" ]; then
YUM=aix
FRSDIR='2.x_AIX'
else
YUM=yum
FRSDIR='2.x_Linux'
fi
# Upload the dir structure to SF yum area. Currently we do not have it preserving permissions
# because that gives errors when different users try to do it.
while ! rsync -rlv --delete * $UPLOADUSER,xcat@web.sourceforge.net:htdocs/yum/xcat-dep/
while ! rsync -rlv --delete * $UPLOADUSER,xcat@web.sourceforge.net:htdocs/$YUM/xcat-dep/
do : ; done
#ssh jbjohnso@shell1.sf.net "cd /home/groups/x/xc/xcat/htdocs/yum/; rm -rf dep-snap; tar jxvf $DFNAME"
# Upload the tarball to the SF FRS Area
#scp ../$DFNAME $UPLOADUSER@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat-dep/2.x_Linux/
while ! rsync -v ../$DFNAME $UPLOADUSER,xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat-dep/2.x_Linux/
while ! rsync -v ../$DFNAME $UPLOADUSER,xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat-dep/$FRSDIR/
do : ; done