diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2009-08-14 02:21:49 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2009-08-14 02:21:49 +0000 |
commit | c7f37382c877e9febdbc2a7fd5fe5fe7034bd606 (patch) | |
tree | f91fc23727ffa7c3f0c8bf59e378f353e3365bd6 /rpm/buildrpm.sh | |
parent | 838c528d1f95765dc8c5eaa6715ff9dd35fe61e8 (diff) | |
download | MPC-c7f37382c877e9febdbc2a7fd5fe5fe7034bd606.tar.gz |
ChangeLogTag: Fri Aug 14 02:20:11 UTC 2009 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'rpm/buildrpm.sh')
-rwxr-xr-x | rpm/buildrpm.sh | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/rpm/buildrpm.sh b/rpm/buildrpm.sh new file mode 100755 index 00000000..c99c7d3b --- /dev/null +++ b/rpm/buildrpm.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +# ****************************************************************** +# Author: Chad Elliott +# Date: 8/13/2009 +# Description: Create an MPC rpm based on the current version number. +# $Id$ +# ****************************************************************** + +## First find out where this script is located +if [ "$0" != "`basename $0`" ]; then + if [ "`echo $0 | cut -c1`" = "/" ]; then + loc="`dirname $0`" + else + loc="`pwd`/`dirname $0`" + fi +else + ## Do my own 'which' here + loc="." + for i in `echo $PATH | tr ':' '\012'`; do + if [ -x "$i/$0" -a ! -d "$i/$0" ]; then + loc="$i" + break + fi + done +fi + +## Now, get back to where the main MPC script is located +while [ ! -x $loc/mpc.pl ]; do + loc=`dirname $loc` +done + +## Save the MPC version +VERSION=`$loc/mpc.pl --version | sed 's/.*v//'` + +## This is where we'll create the spec file and do the work +WDIR=/tmp/mpc.$$ + +## This is the directory name that RPM expects +MDIR=MPC-$VERSION + +## This corresponds to BuildRoot in MPC.spec +BDIR=/tmp/mpc + +## The directory where RPM +if [ -x /usr/src/redhat ]; then + RPMLOC=/usr/src/redhat +else + RPMLOC=/usr/src/packages +fi + +## Create our working directory and make the spec file +mkdir -p $WDIR +cd $WDIR +sed "s/VERSION/$VERSION/" $loc/rpm/MPC.spec > MPC.spec + +## Make a copy of the original MPC source to the new directory +mkdir -p $MDIR/usr/lib/MPC +cd $loc +tar --exclude=.svn -cf - . | (cd $WDIR/$MDIR/usr/lib/MPC; tar -xf -) + +## Create the build source tar.bz2 +cd $WDIR +tar cf $RPMLOC/SOURCES/$MDIR.tar $MDIR +bzip2 -9f $RPMLOC/SOURCES/$MDIR.tar + +## Perform the RPM creation step +rm -rf $BDIR +mkdir -p $BDIR +rpmbuild -bb MPC.spec + +## Clean everything up +cd .. +rm -rf $WDIR $BDIR |