maketarball.sh 531 Bytes
Newer Older
Jakub Sztandera's avatar
Jakub Sztandera committed
1 2 3 4 5 6 7
#!/usr/bin/env bash
# vim: set expandtab sw=2 ts=2:

# bash safe mode
set -euo pipefail
IFS=$'\n\t'

Steven Allen's avatar
Steven Allen committed
8
OUTPUT="$(readlink -f "${1:-go-ipfs-source.tar.gz}")"
Jakub Sztandera's avatar
Jakub Sztandera committed
9 10

TMPDIR="$(mktemp -d)"
Steven Allen's avatar
Steven Allen committed
11
NEWIPFS="$TMPDIR/src/github.com/ipfs/go-ipfs"
Jakub Sztandera's avatar
Jakub Sztandera committed
12 13 14
mkdir -p "$NEWIPFS"
cp -r . "$NEWIPFS"
( cd "$NEWIPFS" &&
Steven Allen's avatar
Steven Allen committed
15 16 17 18 19
      echo $PWD &&
      GOPATH="$TMPDIR" gx install --local &&
      (git rev-parse --short HEAD || true) > .tarball &&
      chmod -R u=rwX,go=rX "$NEWIPFS" # normalize permissions
      tar -czf "$OUTPUT" --exclude="./.git" .
Jakub Sztandera's avatar
Jakub Sztandera committed
20 21 22
)

rm -rf "$TMPDIR"