blob: 9f581cea75a4278198beda5efac9fe411493e783 (
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
|
#!/bin/bash
VERSION="$1"
WORKDIR=$(dirname "${BASH_SOURCE[0]}")
OUTFILE="$WORKDIR/xdp-tools-$VERSION.tar.gz"
PREFIX=xdp-tools-$VERSION
TMPDIR=$(mktemp -d)
set -o errexit
set -o nounset
trap 'status=$?; rm -rf $TMPDIR; exit $status' EXIT HUP INT QUIT TERM
[ -d .git ] || exit 1
if git status -s | grep -Eq '^ ?[AM]'; then
echo "Please commit changes first" >&2
exit 1
fi
git archive -o "$TMPDIR/xdp-tools.tar.gz" --prefix "${PREFIX}/" HEAD
( cd lib/libbpf && git archive -o "$TMPDIR/libbpf.tar.gz" --prefix "${PREFIX}/lib/libbpf/" HEAD)
tar -C "$TMPDIR" -xzf "$TMPDIR/xdp-tools.tar.gz"
tar -C "$TMPDIR" -xzf "$TMPDIR/libbpf.tar.gz"
tar -C "$TMPDIR" -czf "$OUTFILE" "$PREFIX"
echo "Created $OUTFILE"
|