aboutsummaryrefslogtreecommitdiff
path: root/scripts/make-dist.sh
blob: c58524e81fb7fea5013b0415036cc6066f3e8dd5 (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
#!/usr/bin/env bash

set -e

LOCKFILE="$(realpath "${0}").lock"
touch "${LOCKFILE}"
exec 42< "${LOCKFILE}"
flock -x -n 42 || {
    printf '%s\n' "Could not aquire file lock for ${0}. Already running instance?" >&2;
    exit 1;
}

cd "$(dirname "${0}")/.."
if [ ! -d ./.git ]; then
    printf '%s\n' "This script can only by run from a nDPId git repository." >&2
    exit 1;
fi

git submodule update --init ./libnDPI
NDPID_GIT_VERSION="$(git describe --tags)"
cd ./libnDPI && \
    LIBNDPI_GIT_VERSION="$(git describe --tags)"
    git archive --prefix="nDPId-${NDPID_GIT_VERSION}/libnDPI/" -o "../libnDPI-${LIBNDPI_GIT_VERSION}.tar" HEAD && \
    cd ..
git archive --prefix="nDPId-${NDPID_GIT_VERSION}/" -o "./nDPId-${NDPID_GIT_VERSION}.tar" HEAD
tar --concatenate --file="./nDPId-${NDPID_GIT_VERSION}.tar" "./libnDPI-${LIBNDPI_GIT_VERSION}.tar"
bzip2 -9 "./nDPId-${NDPID_GIT_VERSION}.tar"

rm -f "${LOCKFILE}"