1#! /bin/bash
2# This script work for generating rpms without Root rights
3# When you create rmp's with Root rights and you have as example
4# the follow command rm -rf / in your script you are in trouble :-)
5#
6# Change the path names for ANONCVSDIR and RHBASE to you needs.
7#
8# When you would create daily rpm's with update from CVS include
9# delete the # sign at the start from the follow lines
10#
11# cd $ANONCVSDIR
12# cvs update -Pd
13# This scipt create auotmaticly signed rpm's
14# When you don't want signed rpm's change the follow line from
15#
16# rpmbuild -bb --sign phpgroupware-rh.spec             >> $LOGFILE 2>&1
17#
18# to
19# rpmbuild -bb phpgroupware-rh.spec                    >> $LOGFILE 2>&1
20#
21# in the sript
22# How to create GPG keys to sign your rpm's you will found in a seperate
23# Document
24#
25# Script changed 2003 Jul 06 Reiner Jung
26
27VERSION=`grep "%define version" phpgroupware-rh.spec | cut -f3 -d' '`
28HOMEBUILDDIR=`whoami`
29ANONCVSDIR=/build_root/phpgroupware_stable/phpgroupware
30RHBASE=/home/$HOMEBUILDDIR/redhat
31SRCDIR=$RHBASE/SOURCES
32SPECDIR=$RHBASE/SPECS
33LOGFILE=$SPECDIR/build-$VERSION.log
34MD5SUM=$SRCDIR/md5sum-$VERSION.txt
35
36echo "Start Build Process of - $VERSION"                     > $LOGFILE
37echo "---------------------------------------"              >> $LOGFILE 2>&1
38date                                                        >> $LOGFILE 2>&1
39cd $ANONCVSDIR
40cvs update -dP                                              >> $LOGFILE 2>&1
41cd $ANONCVSDIR/..
42tar czvf $SRCDIR/phpgroupware-$VERSION.tar.gz phpgroupware  >> $LOGFILE 2>&1
43tar cjvf $SRCDIR/phpgroupware-$VERSION.tar.bz2 phpgroupware >> $LOGFILE 2>&1
44zip -r -9 $SRCDIR/phpgroupware-$VERSION.zip phpgroupware    >> $LOGFILE 2>&1
45echo "End Build Process of tar.gz, tar.bz, zip"		    >> $LOGFILE 2>&1
46echo "---------------------------------------"              >> $LOGFILE 2>&1
47echo "Create the md5sum file for tar.gz, tar.bz, zip"	    >> $LOGFILE 2>&1
48echo "md5sum from file phpgroupware-$VERSION.tar.gz is:"     > $MD5SUM
49md5sum $SRCDIR/phpgroupware-$VERSION.tar.gz | cut -f1 -d' ' >> $MD5SUM  2>&1
50echo "---------------------------------------"              >> $MD5SUM  2>&1
51echo " "						    >> $MD5SUM  2>&1
52echo "md5sum from file phpgroupware-$VERSION.tar.bz2 is:"   >> $MD5SUM  2>&1
53md5sum $SRCDIR/phpgroupware-$VERSION.tar.bz2 | cut -f1 -d' '>> $MD5SUM  2>&1
54echo "---------------------------------------"              >> $MD5SUM  2>&1
55echo " "						    >> $MD5SUM  2>&1
56echo "md5sum from file phpgroupware-$VERSION.zip is:"       >> $MD5SUM  2>&1
57md5sum $SRCDIR/phpgroupware-$VERSION.zip | cut -f1 -d' '    >> $MD5SUM  2>&1
58echo "End Build md5sum of tar.gz, tar.bz, zip"              >> $LOGFILE 2>&1
59echo "---------------------------------------"              >> $LOGFILE 2>&1
60echo "Build signed source files"			    >> $LOGFILE 2>&1
61gpg -s $SRCDIR/phpgroupware-$VERSION.tar.gz		    >> $LOGFILE 2>&1
62gpg -s $SRCDIR/phpgroupware-$VERSION.tar.bz2		    >> $LOGFILE 2>&1
63gpg -s $SRCDIR/phpgroupware-$VERSION.zip		    >> $LOGFILE 2>&1
64echo "End build of signed of tar.gz, tar.bz, zip"           >> $LOGFILE 2>&1
65echo "---------------------------------------"              >> $LOGFILE 2>&1
66cd $SPECDIR
67rpmbuild -ba --sign phpgroupware-rh.spec                    >> $LOGFILE 2>&1
68echo "End Build Process of - $VERSION single packages"      >> $LOGFILE 2>&1
69echo "---------------------------------------"              >> $LOGFILE 2>&1
70rpmbuild -ba --sign phpgroupware-rh-allapp.spec             >> $LOGFILE 2>&1
71echo "End Build Process of - $VERSION all applications"     >> $LOGFILE 2>&1
72echo "---------------------------------------"              >> $LOGFILE 2>&1
73
74