#!/bin/sh -x
rm -rf cockroach
GOPATH="`pwd`/cockroach"
export GOPATH
mkdir -p $GOPATH
( cd $GOPATH
  mkdir -p src/github.com/cockroachdb
  ( cd src/github.com/cockroachdb
    git clone https://github.com/cockroachdb/cockroach
  )
  ( cd src/github.com/cockroachdb/cockroach
    git co -f master
    git submodule update --init --recursive
  )
)
tar cvf - --exclude .git cockroach | xz -9 >cockroach20-`date '+%Y%m%d'`.tar.xz
rm -rf cockroach
