updated busybox
[kvm-coreboot.git] / bin / fetchgit.sh
blob952de34dc2b24d50157a06efcf9e3eb9b16348e5
1 #!/bin/sh
2 # Check out or update a GIT repository
4 URL=$1
5 DIR=$2
6 TAG=$3
7 TARBALL=$4
8 NAME=$5
10 # If the base git directory doesn't exist, then we need to clone it
12 if [ ! -d $DIR/.git ]; then
13 echo "Cloning $URL..."
14 git-clone $URL $DIR
15 if [ $? -ne 0 ]; then
16 echo "Couldn't clone $URL."
17 exit 1
21 # Fetch the latest and greatest bits
23 export GIT_DIR=$DIR/.git
25 git-fetch $URL
26 git-fetch --tags $URL
27 git-prune-packed
28 git-pack-redundant --all | xargs -r rm
30 # Make the tarball
31 git-tar-tree $TAG $NAME-$TAG | bzip2 > $TARBALL