#!/bin/sh USAGE="Usage: $0 * is relative to the SVN root (eg: branches/dspace-1_4_x/dspace) * is the revision you want to build the release from * is the version number to release as (eg: 1.4.2) Example: ./make-release-package branches/dspace-1_4_x/dspace 1795 1.4.2" SVN="svn" SVN_BASE_URL="https://dspace.svn.sourceforge.net/svnroot/dspace" # Check we have required command-line arguments if [ "$#" != "3" ]; then echo "${USAGE}" exit 1 fi mkdir tmp if [ $? -eq 1 ]; then # If mkdir failed, then tmp/ already exists, and we don't want to overwrite # anything in there. exit 1 fi cd tmp FILENAME="dspace-$3-source" echo "Checking out core code..." $SVN export -r $2 "$SVN_BASE_URL/$1" dspace if [ $? -eq 1 ] || [ ! -d "dspace" ]; then # SVN export failed echo "SVN export failed. Check your path & revision number and try again." cd .. rmdir tmp exit 1 fi if [ ! -f "dspace/make-release-package" ]; then cat <<-EOF ERROR: The file dspace/make-release-package doesn't exist. There must have been a problem with the export. Check the contents of tmp/ to find out what the problem was. EOF exit 1 else # Don't need to include this script! rm -f dspace/make-release-package fi echo "Creating tarball..." mv dspace $FILENAME tar czf $FILENAME.tgz $FILENAME tar cjf $FILENAME.tbz2 $FILENAME zip -r $FILENAME.zip $FILENAME echo "Cleaning up..." cd .. mv tmp/$FILENAME.* . rm -r tmp echo "Packages created: * $FILENAME.tgz * $FILENAME.tbz2 * $FILENAME.zip"