Skip to content

Instantly share code, notes, and snippets.

@hartym
Created May 24, 2018 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hartym/a11792ac8f707f79f6b7c5532ded5fae to your computer and use it in GitHub Desktop.
Save hartym/a11792ac8f707f79f6b7c5532ded5fae to your computer and use it in GitHub Desktop.
sandbox.sh
#! /bin/bash
# Exit if something fails
set -e
# Show everything
set -x
# Set version
export VERSION=`git describe`
git diff-index --quiet --cached HEAD -- || {
echo "repository not clean"
exit 1
}
# Create temporary sandbox and trap removal at exit
SANDBOX=`mktemp -d`
function cleanup {
echo "Removing $SANDBOX"
rm -r $SANDBOX
}
trap cleanup EXIT
# Release path
RELEASE=$SANDBOX/release
pip install -U git-archive-all
git archive-all --force-submodules $RELEASE.tar
tar xf $RELEASE.tar -C $SANDBOX
# Execute
(cd $RELEASE; "$@")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment