#!/bin/sh
rm -rf pdftilecut
mkdir pdftilecut
export GOPATH=`pwd`/pdftilecut
mkdir -p $GOPATH/src/github.com/oxplot/pdftilecut
git clone --depth 1 https://github.com/oxplot/pdftilecut.git $GOPATH/src/github.com/oxplot/pdftilecut
( cd $GOPATH/src/github.com/oxplot/pdftilecut
  git submodule init
  git submodule update --recursive
  export GO111MODULE=on
  go mod vendor -v
)
chmod -R a+rw pdftilecut
tar cf - --exclude .git pdftilecut | xz -9 >pdftilecut-`date '+%Y%m%d'`.tar.xz
rm -rf pdftilecut
