Skip to content

Instantly share code, notes, and snippets.

@paultag
Created August 22, 2011 15:29
Show Gist options
  • Save paultag/1162666 to your computer and use it in GitHub Desktop.
Save paultag/1162666 to your computer and use it in GitHub Desktop.
tarball generator
#!/bin/bash
BUILD_DIR=/var/builds
GNUPG_KEY=DBC1F58D
MIRRORDIR=/git/
WORKDIR=/tmp/$$.d/
echo "Creating workdir: $WORKDIR"
mkdir $WORKDIR
cd $MIRRORDIR
for x in `ls`; do
cd $x
POPDIR=`pwd`
REPOID=$x
TLDID=`basename $x .git`
echo "Working on $REPOID, workind dir name $TLDID"
cd $WORKDIR
git clone file://$MIRRORDIR$REPOID
cd $TLDID
TAGS=`git tag`
for y in $TAGS; do
echo " -> Processing tag $y"
if [ ! -d $BUILD_DIR/$TLDID/$y ]; then
echo "New tag! Wowzers! -- $BUILD_DIR/$TLDID/$y"
ls
cd ..
cp $TLDID $TLDID-$y -r
cd $TLDID-$y
git checkout $y
rm -rf .git
cd ..
tar -zcvf $TLDID-$y.tar.gz $TLDID-$y
rm -rf $TLDID-$y
gpg --local-user $GNUPG_KEY --sign $TLDID-$y.tar.gz
md5sum $TLDID-$y.* > $TLDID-$y.md5sums
mkdir -p $BUILD_DIR/$TLDID/$y
mv $TLDID-$y.* $BUILD_DIR/$TLDID/$y
cd $TLDID
fi
done
cd $POPDIR
# Finish up, if we need it.
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment