aboutsummaryrefslogtreecommitdiff
path: root/mktarball
blob: 885520444d4f74e006a8ffe50bf0c761bb1a91f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#
#
P='mktarball'

if [ "$#" -ne 1 ]; then
	echo 1>&2 "Usage: $P <commitish>"
	exit 1
fi
commit="$1"

if [ ! .git ]; then
	echo 1>&2 "$P: not in the source tree"
	exit 1
fi

# Get the official name for this commit.
name=`git describe --tags "$commit"`

# Build a version file to add to the tarball, we know it is not
# modified as we just took a commit which is unmodified by definition.
tmp="/tmp/tarball-$$"
mkdir -p "$tmp/libhugetlbfs-$name"
echo "$name" >"$tmp/libhugetlbfs-$name/version"

git archive --format=tar --prefix="libhugetlbfs-$name/" "$commit" \
						>"libhugetlbfs-$name.tar"
tar -C "$tmp" -rf "libhugetlbfs-$name.tar" "libhugetlbfs-$name/version"
gzip -9 "libhugetlbfs-$name.tar"

# Clean up the version.
[ -d "$tmp/libhugetlbfs-$name" ] && rm -rf "$tmp"