1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #!/bin/bash # # pack.sh # # pack tarballs for release # # @author Christopher Han <xiphux@gmail.com> # @copyright Copyright (c) 2010 Christopher Han # @package GitPHP # @package util # STAGEDIR="staging" PKGDIR="gitphp" # Prepare the staging directory rm -Rf "${STAGEDIR}" mkdir -p "${STAGEDIR}" # Get a working snapshot of the HEAD git archive --format=tar --prefix=${PKGDIR}/ HEAD | tar -C "${STAGEDIR}" -xvf - # Get the version cd "${STAGEDIR}" VERSION="`cat ${PKGDIR}/include/version.php | grep '^\$gitphp_version = ' | cut -d '\"' -f 2`" if [ -z "${VERSION}" ]; then echo "Could not determine version" exit 1 fi # Make the snapshot versioned PKGVERDIR="${PKGDIR}-${VERSION}" mv -v "${PKGDIR}" "${PKGVERDIR}" cd "${PKGVERDIR}" # Remove the gitignore files find . -iname '.gitignore' -exec rm {} ';' # Remove the debug locale, it's not useful in the released version rm -rf ./locale/zz_Debug # Build the translations ./util/msgfmt.sh # Minify javascript ./util/minify.sh # Remove yuicompressor after we've used it, no need to redistribute it rm -Rf lib/yuicompressor # Remove the utility scripts rm -rf ./util cd .. # Roll the tarballs rm -f ${PKGVERDIR}.zip rm -f ${PKGVERDIR}.tar.bz2 rm -f ${PKGVERDIR}.tar.gz zip -r9 ${PKGVERDIR}.zip ${PKGVERDIR} tar -cf ${PKGVERDIR}.tar ${PKGVERDIR}/ bzip2 -kv9 ${PKGVERDIR}.tar gzip -v9 ${PKGVERDIR}.tar # Remove the working copy rm -rf ${PKGVERDIR} |