build_tarballs.sh 1.19 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/bash
#
# Builds release tarballs of Mahara at the given version, ready for
# distribution
set -e

print_usage() {
    echo "Usage is $0 [version]"
    echo "e.g. $0 0.6.2"
    echo "e.g. $0 1.0.0alpha1"
}

if [ -z "$1" ]; then
    print_usage
    exit 1
fi

MAJOR=${1:0:3}
MINOR=${1:4:1}
MICRO=${1:5}
21
BUILDDIR="/tmp/mahara/tarballs"
22 23 24 25 26 27 28 29 30 31 32 33 34
CURRENTDIR="`pwd`"

if [ -z "${MAJOR}" ] || [ -z "${MINOR}" ]; then
    print_usage
    exit 1
fi

VERSION="${MAJOR}.${MINOR}${MICRO}"

if [ -d ${BUILDDIR} ]; then
    rm -rf ${BUILDDIR}
fi

35
mkdir -p ${BUILDDIR}
36 37 38 39

pushd ${BUILDDIR}

# Get the stable branch
40 41
# git clone -n "http://git.mahara.org/git/mahara.git" mahara
git clone -n "git+ssh://git.catalyst.net.nz/var/gitprivate/mahara-security.git" mahara
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61

pushd ${BUILDDIR}/mahara

# Switch to the release tag
RELEASETAG="`echo $VERSION | tr '[:lower:]' '[:upper:]'`_RELEASE"
git checkout $RELEASETAG

# Remove git stuff
rm .git -rf
find . -name '.gitignore' -exec rm {} \;

popd

mv mahara mahara-${VERSION}

tar zcf ${CURRENTDIR}/mahara-${VERSION}.tar.gz mahara-${VERSION}
tar jcf ${CURRENTDIR}/mahara-${VERSION}.tar.bz2 mahara-${VERSION}
zip -qrT9 ${CURRENTDIR}/mahara-${VERSION}.zip mahara-${VERSION}

popd
62
rm -rf ${BUILDDIR}