Created
April 11, 2011 20:05
-
-
Save larsks/914214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pkg=$(basename $(pwd)) | |
tag=HEAD | |
while getopts 'n:t:' ch; do | |
case $ch in | |
(n) pkg=$OPTARG;; | |
(t) tag=$OPTARG;; | |
esac | |
done | |
shift $(( $OPTIND - 1 )) | |
[ "$1" ] && version=$1 || | |
version=$(cat VERSION 2>/dev/null) || | |
version=$(awk '/^Version:/ {print $2}' $pkg.spec 2>/dev/null) | |
[ "$version" ] || { | |
echo "missing version." >&2 | |
exit 1 | |
} | |
[ -d .git ] || { | |
echo "this does not look like a git repository." >&2 | |
exit 1 | |
} | |
echo "+ Generating version $version release from $tag." | |
git archive --prefix="$pkg-$version/" $tag | | |
gzip > $pkg-$version.tar.gz | |
ls -l $pkg-$version.tar.gz | |
echo "+ All done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment