#!/bin/sh -x
rm -rf postgresql-walg
GOPATH="`pwd`/postgresql-walg"
export GOPATH
mkdir -p $GOPATH/src/github.com/wal-g
git clone https://github.com/wal-g/wal-g $GOPATH/src/github.com/wal-g/wal-g
( cd $GOPATH/src/github.com/wal-g/wal-g
  # dep ensure
  make deps
)
tar cvf - --exclude .git postgresql-walg | xz -9 >postgresql-walg-`date '+%Y%m%d'`.tar.xz
rm -rf postgresql-walg
