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.20 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 # - changed website to download from to www.muttng.org
35 # - added cosmetic changes concerning sent mail
36 # - added rm -rf $SRCDIR/muttng-* and more cleanup on exit
41 # - add section of Changelog/SVN to sent mail if successful
43 # Local site specific variables. Change to suit your site!
48 DSTDIR=/var/www/iainlea.dyndns.org/software/muttng
49 BLDDIR=/usr/src/redhat
51 # Remote site specific variables. Should not need changing!
52 SITE=http://nion.modprobe.de/mutt-ng/snapshots/
53 FILE=muttng-latest.tar.gz
55 # You should not need to change anything below this line!
56 SRCDIR=$BLDDIR/SOURCES
57 RPMSDIR=$BLDDIR/RPMS/$ARCH
62 if [ ! -d $TMPDIR ]; then
63 echo "Error: \$TMPDIR $TMPDIR - does not exist. Edit to match your site!"
66 if [ ! -d $DSTDIR ]; then
67 echo "Error: \$DSTDIR $DSTDIR - does not exist. Edit to match your site!"
70 if [ ! -d $SRCDIR ]; then
71 echo "Error: \$SRCDIR $SRCDIR - does not exist. Edit to match your site!"
74 if [ ! -d $RPMSDIR ]; then
75 echo "Error: \$RPMSDIR $RPMSDIR - does not exist. Edit to match your site!"
78 if [ ! -d $SRPMDIR ]; then
79 echo "Error: \$SRPMDIR $SRPMDIR - does not exist. Edit to match your site!"
85 echo "Backup: $TMPDIR/$SPEC"
86 /bin/mv -f $TMPDIR/$SPEC $TMPDIR/$SPEC.bak >/dev/null 2>&1
87 /bin/rm -f $TMPDIR/$SPEC.in >/dev/null 2>&1
89 echo "Delete: $TMPDIR/$FILE"
90 /bin/rm -f $TMPDIR/$FILE >/dev/null 2>&1
92 echo "Delete: $TMPDIR/muttng-*/"
93 (find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1
95 echo "Delete: $SRCDIR/muttng-*.tar.gz"
96 (find $SRCDIR/muttng-*tar.gz -print | sort -r | xargs /bin/rm -f) >/dev/null 2>&1
98 echo "Delete: $SRCDIR/muttng-*/"
99 # find $SRCDIR/muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf >/dev/null 2>&1
100 (cd $SRCDIR; find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1
102 echo "FetchIt $SITE/$FILE"
103 wget -O $FILE $SITE/$FILE >/dev/null 2>&1
108 NAME=`find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | head -1`
111 VER=`echo $NAME | cut -d '-' -f2`
112 # echo "Version $VER"
114 echo "Parsing $NAME/contrib/$SPEC"
115 cp $NAME/contrib/$SPEC $SPEC.in
116 sed -e "s/^Version:.*$/Version: $VER/" < $SPEC.in > $SPEC
117 REL=`egrep "Release: " $SPEC | cut -d ' ' -f2`
118 egrep "Version: " $SPEC
119 egrep "Release: " $SPEC
121 echo "BuildIt $SRCDIR/$NAME.tar.gz"
122 mv $FILE $SRCDIR/$NAME.tar.gz
124 rpmbuild -ba $SPEC >$TMPDIR/$NAME.rpmbuild 2>&1
126 # echo "CheckIt $RPMSDIR/muttng-$VER-$REL.i386.rpm"
127 if [ -e $RPMSDIR/muttng-$VER-$REL.i386.rpm ]
129 echo "BuiltOK $RPMSDIR/muttng-$VER-$REL.i386.rpm"
130 cp $RPMSDIR/muttng-$VER-$REL.i386.rpm $DSTDIR
131 echo "$DSTDIR/muttng-$VER-$REL.i386.rpm" > $TMPDIR/$NAME.rpmbuild
133 # echo "CheckIt $SRPMDIR/muttng-$VER-$REL.src.rpm"
134 if [ -e $SRPMDIR/muttng-$VER-$REL.src.rpm ]
136 echo "BuiltOK $SRPMDIR/muttng-$VER-$REL.src.rpm"
137 cp $SRPMDIR/muttng-$VER-$REL.src.rpm $DSTDIR
138 echo "$DSTDIR/muttng-$VER-$REL.src.rpm" >> $TMPDIR/$NAME.rpmbuild
143 echo "Mailing $ADDR - BUILT"
144 echo >> $TMPDIR/$NAME.rpmbuild
145 head -15 $TMPDIR/$NAME/ChangeLog.mutt-ng >> $TMPDIR/$NAME.rpmbuild
146 echo "..." >> $TMPDIR/$NAME.rpmbuild
147 $MAIL -s "Mutt-NG: BUILT - $NAME" $ADDR < $TMPDIR/$NAME.rpmbuild
149 echo "Mailing $ADDR - ERROR"
150 $MAIL -s "Mutt-NG: ERROR - $NAME" $ADDR < $TMPDIR/$NAME.rpmbuild
153 # echo "Cleanup $TMPDIR/muttng-*/ $TMPDIR/$NAME.rpmbuild"
154 /bin/rm -f $TMPDIR/$NAME.rpmbuild
155 (cd $TMPDIR; find ./muttng-* -type d -print | sort -r | cut -d '/' -f2 | uniq | xargs /bin/rm -rf) >/dev/null 2>&1