make-archive.sh 665 Bytes
Newer Older
1 2
#!/bin/sh -e
# Create a distribution tarball, like 'make dist' from autotools.
3
cd "$(git rev-parse --show-toplevel)"
4
ver=$(git describe | sed 's/^v//' | sed 's/-/\./g')
5 6 7 8 9 10 11 12
test 0 -ne $(git status --porcelain | wc -l) && \
	echo "Git working tree is dirty, make it clean first" && \
	exit 1
git submodule status --recursive | grep -q '^[^ ]' && \
	echo "Git submodules are dirty, run: git submodule update --recursive --init" && \
	exit 2

# 'git ls-files --recurse-submodules' works only if modules are initialized
13
name="knot-resolver-$ver"
14
tar caf "$name.tar.xz" -h --no-recursion --transform "s|^|$name/|" -- $(git ls-files --recurse-submodules)
15
echo "$name.tar.xz"