2008-07-22 14:02:33 +02:00
|
|
|
#!/bin/bash -x
|
2004-01-25 01:18:54 +01:00
|
|
|
# This script work for generating rpms without Root rights
|
2008-07-22 14:02:33 +02:00
|
|
|
# When you create rmp's with Root rights and you have as example
|
2004-01-25 01:18:54 +01:00
|
|
|
# the follow command rm -rf / in your script you are in trouble :-)
|
|
|
|
#
|
|
|
|
# Change the path names for ANONCVSDIR and RHBASE to you needs.
|
2008-07-22 14:02:33 +02:00
|
|
|
#
|
2004-01-25 01:18:54 +01:00
|
|
|
# When you would create daily rpm's with update from CVS include
|
|
|
|
# delete the # sign at the start from the follow lines
|
2008-07-22 14:02:33 +02:00
|
|
|
#
|
2004-01-25 01:18:54 +01:00
|
|
|
# cd $ANONCVSDIR
|
|
|
|
# cvs update -Pd
|
|
|
|
# This scipt create auotmaticly signed rpm's
|
|
|
|
# When you don't want signed rpm's change the follow line from
|
|
|
|
#
|
|
|
|
# rpmbuild -bb --sign egroupware-rh.spec >> $LOGFILE 2>&1
|
2008-07-22 14:02:33 +02:00
|
|
|
#
|
2004-01-25 01:18:54 +01:00
|
|
|
# to
|
|
|
|
# rpmbuild -bb egroupware-rh.spec >> $LOGFILE 2>&1
|
2008-07-22 14:02:33 +02:00
|
|
|
#
|
2005-11-15 02:56:12 +01:00
|
|
|
# in the script
|
2004-01-25 01:18:54 +01:00
|
|
|
# How to create GPG keys to sign your rpm's you will found in a seperate
|
|
|
|
# Document
|
|
|
|
#
|
2004-05-21 23:39:09 +02:00
|
|
|
# Script changed 2004 May 21 Reiner Jung
|
2005-11-15 02:56:12 +01:00
|
|
|
# Script changed 2005 Apr 15 by Ralf Becker and Wim Bonis
|
|
|
|
# 2005 Sep 20 Ralf Becker: disabled fedora 2 build
|
2004-01-25 01:18:54 +01:00
|
|
|
|
2008-07-22 14:02:33 +02:00
|
|
|
#SVNURL="http://svn.egroupware.org/egroupware/branches/1.6/"
|
|
|
|
#SVNURL="http://svn.egroupware.org/egroupware/tags/1.6pre1/"
|
|
|
|
SVNURL="http://svn.egroupware.org/egroupware/trunk/"
|
|
|
|
|
|
|
|
SPECFILE="egroupware-1.6.spec"
|
2006-05-18 04:43:50 +02:00
|
|
|
SOURCEFILES="egroupware_fedora.tar.bz2 egroupware_suse.tar.bz2 manageheader.php.patch class.uiasyncservice.inc.php.patch"
|
2004-05-21 23:39:09 +02:00
|
|
|
|
2008-07-22 14:02:33 +02:00
|
|
|
CONTRIB="gallery icalsrv mydms"
|
2007-04-30 16:12:05 +02:00
|
|
|
EXTRAPACKAGES="egw-pear $CONTRIB"
|
|
|
|
for p in $EXTRAPACKAGES
|
2005-11-15 02:56:12 +01:00
|
|
|
do
|
|
|
|
EXCLUDE_CONTRIB="$EXCLUDE_CONTRIB --exclude=egroupware/$p"
|
|
|
|
ONLY_CONTRIB="$ONLY_CONTRIB egroupware/$p"
|
|
|
|
done
|
2004-05-21 23:39:09 +02:00
|
|
|
|
2004-01-25 01:18:54 +01:00
|
|
|
PACKAGENAME=`grep "%define packagename" $SPECFILE | cut -f3 -d' '`
|
2006-03-28 01:37:50 +02:00
|
|
|
VERSION=`grep "%define egwversion" $SPECFILE | cut -f3 -d' '`
|
2004-01-25 01:18:54 +01:00
|
|
|
PACKAGING=`grep "%define packaging" $SPECFILE | cut -f3 -d' '`
|
2008-07-22 14:02:33 +02:00
|
|
|
|
2004-01-25 01:18:54 +01:00
|
|
|
HOMEBUILDDIR=`whoami`
|
2007-04-30 16:12:05 +02:00
|
|
|
ANONCVSDIR=/tmp/build_root/egw_buildroot-svn
|
|
|
|
NOSVNDIR=/tmp/build_root/egw_buildroot
|
2005-11-15 02:56:12 +01:00
|
|
|
RHBASE=$HOME/rpm
|
2004-01-25 01:18:54 +01:00
|
|
|
SRCDIR=$RHBASE/SOURCES
|
|
|
|
SPECDIR=$RHBASE/SPECS
|
2007-04-30 16:12:05 +02:00
|
|
|
LOGFILE=$RHBASE/LOG/build-$PACKAGENAME-$VERSION.$PACKAGING.log
|
|
|
|
VIRUSSCAN=$SPECDIR/clamav_scan-$PACKAGENAME-$VERSION.$PACKAGING.log
|
|
|
|
MD5SUM=$SRCDIR/md5sum-$PACKAGENAME-$VERSION.$PACKAGING.txt
|
2004-01-25 01:18:54 +01:00
|
|
|
|
2007-04-30 16:12:05 +02:00
|
|
|
mkdir -p $RHBASE/SOURCES $RHBASE/SPECS $RHBASE/BUILD $RHBASE/SRPMS $RHBASE/RPMS $RHBASE/LOG $ANONCVSDIR $NOSVNDIR
|
2004-07-03 13:09:40 +02:00
|
|
|
|
2006-03-28 01:37:50 +02:00
|
|
|
cp *.spec $RHBASE/SPECS/
|
|
|
|
cp $SOURCEFILES $RHBASE/SOURCES/
|
2006-05-18 04:43:50 +02:00
|
|
|
echo "Starting build process of - $PACKAGENAME $VERSION" > $LOGFILE
|
|
|
|
echo "" >> $LOGFILE 2>&1
|
2004-01-25 01:18:54 +01:00
|
|
|
date >> $LOGFILE 2>&1
|
|
|
|
cd $ANONCVSDIR
|
2005-11-15 02:56:12 +01:00
|
|
|
|
|
|
|
if [ ! -d egroupware/phpgwapi ] # new checkout
|
|
|
|
then
|
2007-04-30 16:12:05 +02:00
|
|
|
if [ -z "$SVNREVISION" ]; then
|
|
|
|
echo -n "Creating a new checkout ... " >> $LOGFILE 2>&1
|
|
|
|
svn checkout $SVNURL"aliases/default" ./
|
|
|
|
else
|
|
|
|
echo -n "Creating a new checkout for revision $SVNREVISION ... " >> $LOGFILE 2>&1
|
|
|
|
svn checkout -r $SVNREVISION $SVNURL"aliases/default" ./
|
|
|
|
fi
|
2008-07-22 14:02:33 +02:00
|
|
|
|
2007-04-30 16:12:05 +02:00
|
|
|
cd egroupware
|
2007-06-05 10:31:04 +02:00
|
|
|
for CONTRIBMODULE in $CONTRIB; do
|
2007-04-30 16:12:05 +02:00
|
|
|
if [ -z "$CONTRIB_SVNREVISION" ]; then
|
|
|
|
svn checkout $SVNURL"$CONTRIBMODULE"
|
|
|
|
else
|
|
|
|
svn checkout -r $SVNREVISION $SVNURL"$CONTRIBMODULE"
|
|
|
|
fi
|
|
|
|
done
|
2008-11-11 14:26:03 +01:00
|
|
|
else
|
|
|
|
[ -z "$SVNREVISION" ] && SVNREVISION=HEAD
|
2007-04-30 16:12:05 +02:00
|
|
|
echo -n "Updating existing checkout ... " >> $LOGFILE 2>&1
|
2008-07-22 14:02:33 +02:00
|
|
|
cd egroupware
|
2008-11-11 14:26:03 +01:00
|
|
|
svn update -r $SVNREVISION . *
|
2005-11-15 02:56:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
cd $ANONCVSDIR
|
|
|
|
|
2006-05-18 04:43:50 +02:00
|
|
|
echo "done" >> $LOGFILE 2>&1
|
2005-11-15 02:56:12 +01:00
|
|
|
|
2008-11-11 14:26:03 +01:00
|
|
|
echo -n "Change directory rights back ... " >> $LOGFILE 2>&1
|
|
|
|
chmod -R u=rwX,g=rX,o=rX . >> $LOGFILE 2>&1
|
2006-05-18 04:43:50 +02:00
|
|
|
echo "done" >> $LOGFILE 2>&1
|
2004-01-25 01:18:54 +01:00
|
|
|
|
2006-05-18 04:43:50 +02:00
|
|
|
echo -n "Starting anti virus scan ... " >> $LOGFILE 2>&1
|
2008-07-22 14:02:33 +02:00
|
|
|
test -x /usr/bin/clamscan && /usr/bin/clamscan --quiet -r $ANONCVSDIR --log=$VIRUSSCAN
|
2006-05-18 04:43:50 +02:00
|
|
|
echo "done" >> $LOGFILE 2>&1
|
2004-01-25 01:18:54 +01:00
|
|
|
|
2007-04-30 16:12:05 +02:00
|
|
|
rm -rf $NOSVNDIR/egroupware
|
|
|
|
cp -ra $ANONCVSDIR/egroupware $NOSVNDIR
|
|
|
|
find $NOSVNDIR -name .svn | xargs rm -rf
|
|
|
|
|
|
|
|
cd $NOSVNDIR
|
|
|
|
echo -n "building tar.gz ... " >> $LOGFILE 2>&1
|
2008-07-22 14:02:33 +02:00
|
|
|
tar --owner=root --group=root -czf $SRCDIR/$PACKAGENAME-$VERSION.$PACKAGING.tar.gz $EXCLUDE_CONTRIB egroupware 2>&1 | tee -a $LOGFILE
|
2007-04-30 16:12:05 +02:00
|
|
|
for CONTRIBMODULE in $EXTRAPACKAGES; do
|
2008-07-22 14:02:33 +02:00
|
|
|
tar --owner=root --group=root -czf $SRCDIR/$PACKAGENAME-$CONTRIBMODULE-$VERSION.$PACKAGING.tar.gz egroupware/$CONTRIBMODULE >> $LOGFILE 2>&1
|
2007-04-30 16:12:05 +02:00
|
|
|
done
|
|
|
|
echo "done" >> $LOGFILE 2>&1
|
|
|
|
|
|
|
|
echo -n "building tar.bz2 ... " >> $LOGFILE 2>&1
|
2008-07-22 14:02:33 +02:00
|
|
|
tar --owner=root --group=root -cjf $SRCDIR/$PACKAGENAME-$VERSION.$PACKAGING.tar.bz2 $EXCLUDE_CONTRIB egroupware >> $LOGFILE 2>&1
|
2007-04-30 16:12:05 +02:00
|
|
|
for CONTRIBMODULE in $EXTRAPACKAGES; do
|
2008-07-22 14:02:33 +02:00
|
|
|
tar --owner=root --group=root -cjf $SRCDIR/$PACKAGENAME-$CONTRIBMODULE-$VERSION.$PACKAGING.tar.bz2 egroupware/$CONTRIBMODULE >> $LOGFILE 2>&1
|
2007-04-30 16:12:05 +02:00
|
|
|
done
|
|
|
|
echo "done" >> $LOGFILE 2>&1
|
|
|
|
|
|
|
|
echo -n "building zip ... " >> $LOGFILE 2>&1
|
|
|
|
for CONTRIBMODULE in $EXTRAPACKAGES; do
|
|
|
|
zip -q -r -9 $SRCDIR/$PACKAGENAME-$CONTRIBMODULE-$VERSION.$PACKAGING.zip egroupware/$CONTRIBMODULE >> $LOGFILE 2>&1
|
|
|
|
done
|
2008-11-11 14:26:03 +01:00
|
|
|
rm -rf $ONLY_CONTRIB >> $LOGFILE 2>&1
|
|
|
|
zip -q -r -9 $SRCDIR/$PACKAGENAME-$VERSION.$PACKAGING.zip egroupware >> $LOGFILE 2>&1
|
2006-05-18 04:43:50 +02:00
|
|
|
echo "done" >> $LOGFILE 2>&1
|
|
|
|
|
|
|
|
echo "Building tar.gz, tar.bz and zip archives finnished" >> $LOGFILE 2>&1
|
2004-01-25 01:18:54 +01:00
|
|
|
|
2007-06-05 10:31:04 +02:00
|
|
|
echo "------------------------------------------" >> $LOGFILE 2>&1
|
2006-03-28 01:37:50 +02:00
|
|
|
echo "Create the md5sum file for tar.gz, tar.bz, zip ($MD5SUM)" >> $LOGFILE 2>&1
|
2007-06-05 10:31:04 +02:00
|
|
|
echo "------------------------------------------" >> $LOGFILE 2>&1
|
2004-02-09 10:53:24 +01:00
|
|
|
|
2007-06-05 10:31:04 +02:00
|
|
|
cd $SRCDIR
|
2008-07-22 14:02:33 +02:00
|
|
|
for f in eGroupware*-$VERSION.$PACKAGING.*
|
2007-06-05 10:31:04 +02:00
|
|
|
do
|
|
|
|
md5sum $f >> $MD5SUM 2>&1
|
2007-04-30 16:12:05 +02:00
|
|
|
done
|
|
|
|
|
2007-06-05 10:31:04 +02:00
|
|
|
echo "sign the md5sum file" >> $LOGFILE 2>&1
|
|
|
|
rm -f $MD5SUM.asc >> $LOGFILE 2>&1
|
|
|
|
gpg --local-user packager@egroupware.org --clearsign $MD5SUM >> $LOGFILE 2>&1
|
2007-04-30 16:12:05 +02:00
|
|
|
|
2007-06-05 10:31:04 +02:00
|
|
|
echo "delete the original md5sum file" >> $LOGFILE 2>&1
|
|
|
|
rm -rf $MD5SUM >> $LOGFILE 2>&1
|
2007-04-30 16:12:05 +02:00
|
|
|
|
2005-11-15 02:56:12 +01:00
|
|
|
echo "------------------------------------------" >> $LOGFILE 2>&1
|
2007-06-05 10:31:04 +02:00
|
|
|
echo "End Create md5sum of tar.gz, tar.bz, zip" >> $LOGFILE 2>&1
|
2005-11-15 02:56:12 +01:00
|
|
|
echo "------------------------------------------" >> $LOGFILE 2>&1
|
2004-01-25 01:18:54 +01:00
|
|
|
|
2007-06-05 10:31:04 +02:00
|
|
|
echo "Building of $PACKAGENAME $VERSION finnished" >> $LOGFILE 2>&1
|