3 # ABSOLUTELY NO WARRANTY WITH THIS PACKAGE. USE IT AT YOUR OWN RISK.
5 # Download, re-config & build latest mutt-ng tarball as RPM & SRPM files
7 # Usage: muttng-rpmbuild.sh
9 # Copyright (C) 2005 muttng-rpmbuild.sh 1.10 Iain Lea iain@bricbrac.de
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation; either version 2 of
14 # the License, or (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 # See the GNU General Public License for more details.
21 # You should have received a copy of the GNU GPL along with this
22 # program; if not, write to the Free Software Foundation, Inc.,
23 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 # - added cosmetic changes concerning sent mail
34 # - added rm -rf $SRCDIR/muttng-* and more cleanup on exit
39 # - add section of Changelog/SVN to sent mail if successful
41 # Local site specific variables. Change to suit your site!
46 DSTDIR=/var/www/iainlea.dyndns.org/software/muttng
47 BLDDIR=/usr/src/redhat
49 # Remote site specific variables. Should not need changing!
50 SITE=http://mutt-ng.berlios.de/snapshots
51 FILE=muttng-latest.tar.gz
53 # You should not need to change anything below this line!
54 SRCDIR=$BLDDIR/SOURCES
55 RPMSDIR=$BLDDIR/RPMS/$ARCH
60 if [ ! -d $TMPDIR ]; then
61 echo "Error: \$TMPDIR $TMPDIR - does not exist. Edit to match your site!"
64 if [ ! -d $DSTDIR ]; then
65 echo "Error: \$DSTDIR $DSTDIR - does not exist. Edit to match your site!"
68 if [ ! -d $SRCDIR ]; then
69 echo "Error: \$SRCDIR $SRCDIR - does not exist. Edit to match your site!"
72 if [ ! -d $RPMSDIR ]; then
73 echo "Error: \$RPMSDIR $RPMSDIR - does not exist. Edit to match your site!"
76 if [ ! -d $SRPMDIR ]; then
77 echo "Error: \$SRPMDIR $SRPMDIR - does not exist. Edit to match your site!"
83 echo "Backup: $TMPDIR/$SPEC"
84 /bin/mv -f $TMPDIR/$SPEC $TMPDIR/$SPEC.bak >/dev/null 2>&1
85 /bin/rm -f $TMPDIR/$SPEC.in >/dev/null 2>&1
87 echo "Delete: $TMPDIR/$FILE"
88 /bin/rm -f $TMPDIR/$FILE >/dev/null 2>&1
90 echo "Delete: $TMPDIR/muttng-*/"
91 (find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1
93 echo "Delete: $SRCDIR/muttng-*.tar.gz"
94 (find $SRCDIR/muttng-*tar.gz -print | sort -r | xargs /bin/rm -f) >/dev/null 2>&1
96 echo "Delete: $SRCDIR/muttng-*/"
97 # find $SRCDIR/muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf >/dev/null 2>&1
98 (cd $SRCDIR; find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1
100 echo "FetchIt $SITE/$FILE"
101 wget -O $FILE $SITE/$FILE >/dev/null 2>&1
106 NAME=`find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | head -1`
109 VER=`echo $NAME | cut -d '-' -f2`
110 # echo "Version $VER"
112 echo "Parsing $NAME/contrib/$SPEC"
113 cp $NAME/contrib/$SPEC $SPEC.in
114 sed -e "s/^Version:.*$/Version: $VER/" < $SPEC.in > $SPEC
115 REL=`egrep "Release: " $SPEC | cut -d ' ' -f2`
116 egrep "Version: " $SPEC
117 egrep "Release: " $SPEC
119 echo "BuildIt $SRCDIR/$NAME.tar.gz"
120 mv $FILE $SRCDIR/$NAME.tar.gz
122 rpmbuild -ba $SPEC >$TMPDIR/$NAME.rpmbuild 2>&1
124 # echo "CheckIt $RPMSDIR/muttng-$VER-$REL.i386.rpm"
125 if [ -e $RPMSDIR/muttng-$VER-$REL.i386.rpm ]
127 echo "BuiltOK $RPMSDIR/muttng-$VER-$REL.i386.rpm"
128 cp $RPMSDIR/muttng-$VER-$REL.i386.rpm $DSTDIR
129 echo "$DSTDIR/muttng-$VER-$REL.i386.rpm" > $TMPDIR/$NAME.rpmbuild
131 # echo "CheckIt $SRPMDIR/muttng-$VER-$REL.src.rpm"
132 if [ -e $SRPMDIR/muttng-$VER-$REL.src.rpm ]
134 echo "BuiltOK $SRPMDIR/muttng-$VER-$REL.src.rpm"
135 cp $SRPMDIR/muttng-$VER-$REL.src.rpm $DSTDIR
136 echo "$DSTDIR/muttng-$VER-$REL.src.rpm" >> $TMPDIR/$NAME.rpmbuild
141 echo "Mailing $ADDR - BUILT"
142 echo >> $TMPDIR/$NAME.rpmbuild
143 head -15 $TMPDIR/$NAME/ChangeLog.mutt-ng >> $TMPDIR/$NAME.rpmbuild
144 echo "..." >> $TMPDIR/$NAME.rpmbuild
145 $MAIL -s "Mutt-NG: BUILT - $NAME" $ADDR < $TMPDIR/$NAME.rpmbuild
147 echo "Mailing $ADDR - ERROR"
148 $MAIL -s "Mutt-NG: ERROR - $NAME" $ADDR < $TMPDIR/$NAME.rpmbuild
151 # echo "Cleanup $TMPDIR/muttng-*/ $TMPDIR/$NAME.rpmbuild"
152 /bin/rm -f $TMPDIR/$NAME.rpmbuild
153 (cd $TMPDIR; find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1