#!/bin/sh -f tarball="$1" if test "$tarball" = ""; then echo "Usage: buildrpm.sh " exit 1 fi # Get the version number... first="`echo $tarball | cut -d- -f2`" version="`echo $first | sed -e 's/\.tar\.gz//'`" unset first # this is the directory where "make rpm" was invoked from rpmbuilddir="`pwd`" # do we have the spec file? if test ! -f "lam-generic.spec"; then echo "Can't find lam-generic.spec file" exit 1 fi # make sure the tarball is out there if test ! -f $tarball; then echo "Can't find $tarball" exit 1 fi if test -d /usr/src/RPM; then rpmtopdir="/usr/src/RPM" else rpmtopdir="/usr/src/redhat" fi # make sure we have write access to the directories we need if test ! -w $rpmtopdir/SOURCES ; then echo "Problem creating rpms: You do not have a $rpmtopdir directory" echo "tree or you do not have write access to the $rpmtopdir directory" echo "tree. Please remedy and try again." exit 1 fi # move the tarball and spec file to the rpm directory, # replace the version string, and insert the copyright dealy... spectmp=/tmp/lam-generic.spec$$ cp $tarball $rpmtopdir/SOURCES sed -e 's/LAMVERSION/'$version'/g' lam-generic.spec > $spectmp # build all three RPMS... for transport in sysv usysv tcp; do echo "MAKING RPM FOR TRANSPORT: $transport" sed -e 's/LAMTRANSPORT/'$transport'/g' $spectmp > $rpmtopdir/SPECS/lam.spec rpm -ba $rpmtopdir/SPECS/lam.spec done rm -rf $spectmp cat <86/ The sources rpms are locate in $rpmtopdir/SRPMS/ EOF