#!/bin/sh -x
rm -rf opa
GOPATH="`pwd`/opa"
export GOPATH
mkdir -p $GOPATH
( cd $GOPATH
  mkdir -p src/github.com/open-policy-agent
  cd src/github.com/open-policy-agent
  git clone --depth 1 https://github.com/open-policy-agent/opa 
  ( cd opa
    # glide update --strip-vendor
    go get -v -d
  )
)
#tar cvf - --exclude .git opa | xz -9 >opa-`date '+%Y%m%d'`.tar.xz
tar cvf - opa | xz -9 >opa-`date '+%Y%m%d'`.tar.xz
rm -rf opa
