mirror of
https://github.com/ipfs/kubo.git
synced 2025-05-17 15:06:47 +08:00

TMPDIR is a special variable indicating the _system_ temporary directory root. Unfortunately, go refuses to honor `go.mod` files in this directory to prevent random `/tmp/go.mod` files from messing with modules cloned into `/tmp`. The fix is simple: rename TMPDIR to TEMP.
27 lines
541 B
Bash
Executable File
27 lines
541 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# vim: set expandtab sw=2 ts=2:
|
|
|
|
# bash safe mode
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
# readlink doesn't work on macos
|
|
OUTPUT="${1:-go-ipfs-source.tar.gz}"
|
|
if ! [[ "$OUTPUT" = /* ]]; then
|
|
OUTPUT="$PWD/$OUTPUT"
|
|
fi
|
|
|
|
GOCC=${GOCC=go}
|
|
|
|
TEMP="$(mktemp -d)"
|
|
cp -r . "$TEMP"
|
|
( cd "$TEMP" &&
|
|
echo $PWD &&
|
|
$GOCC mod vendor &&
|
|
(git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || true) > .tarball &&
|
|
chmod -R u=rwX,go=rX "$TEMP" # normalize permissions
|
|
tar -czf "$OUTPUT" --exclude="./.git" .
|
|
)
|
|
|
|
rm -rf "$TEMP"
|