mirror of
https://github.com/utoni/nDPId.git
synced 2026-04-28 06:59:35 +00:00
Build system cleanup / cosmetics.
* libnDPI submodule update Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
parent
54e0601fec
commit
5954e46340
7 changed files with 41 additions and 25 deletions
42
scripts/daemon.sh
Executable file
42
scripts/daemon.sh
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
# Simple nDPId/nDPIsrvd start/stop script for testing purposes.
|
||||
#
|
||||
|
||||
NUSER="nobody"
|
||||
NSUFFIX="${NSUFFIX:-daemon-test}"
|
||||
|
||||
if [ x"${1}" = x -o x"${2}" = x ]; then
|
||||
printf '%s\n' "usage: ${0} [nDPId-path] [nDPIsrvd-path]" >&2
|
||||
printf '\n\t%s=%s\n' 'env NUSER' "${NUSER}" >&2
|
||||
printf '\t%s=%s\n' 'env NSUFFIX' "${NSUFFIX}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -r "/tmp/nDPId-${NSUFFIX}.pid" -o -r "/tmp/nDPIsrvd-${NSUFFIX}.pid" ]; then
|
||||
nDPId_PID="$(cat "/tmp/nDPId-${NSUFFIX}.pid" 2>/dev/null)"
|
||||
nDPIsrvd_PID="$(cat "/tmp/nDPIsrvd-${NSUFFIX}.pid" 2>/dev/null)"
|
||||
|
||||
if [ x"${nDPId_PID}" != x ]; then
|
||||
sudo kill "${nDPId_PID}"
|
||||
else
|
||||
printf '%s\n' "${1} not started .." >&2
|
||||
fi
|
||||
|
||||
if [ x"${nDPIsrvd_PID}" != x ]; then
|
||||
kill "${nDPIsrvd_PID}"
|
||||
else
|
||||
printf '%s\n' "${2} not started .." >&2
|
||||
fi
|
||||
|
||||
printf '%s\n' "daemons stopped" >&2
|
||||
else
|
||||
set -x
|
||||
${2} -p "/tmp/nDPIsrvd-${NSUFFIX}.pid" -c "/tmp/nDPIsrvd-${NSUFFIX}-collector.sock" -s "/tmp/nDPIsrvd-${NSUFFIX}-distributor.sock" -d
|
||||
sudo chgrp "$(id -n -g "${NUSER}")" "/tmp/nDPIsrvd-${NSUFFIX}-collector.sock"
|
||||
sudo chmod g+w "/tmp/nDPIsrvd-${NSUFFIX}-collector.sock"
|
||||
sudo ${1} -p "/tmp/nDPId-${NSUFFIX}.pid" -c "/tmp/nDPIsrvd-${NSUFFIX}-collector.sock" -d -u "${NUSER}"
|
||||
set +x
|
||||
printf '%s\n' "daemons started" >&2
|
||||
printf '%s\n' "You may now run examples e.g.: $(realpath --relative-to="$(pwd)" $(dirname "${0}")/../examples/py-flow-info/flow-info.py) --unix /tmp/nDPIsrvd-${NSUFFIX}-distributor.sock"
|
||||
fi
|
||||
23
scripts/get-and-build-libndpi.sh
Executable file
23
scripts/get-and-build-libndpi.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
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}")/.."
|
||||
git submodule update --init ./libnDPI
|
||||
|
||||
cd ./libnDPI
|
||||
DEST_INSTALL="${DEST_INSTALL:-$(realpath ./install)}"
|
||||
MAKE_PROGRAM="${MAKE_PROGRAM:-make -j4}"
|
||||
./autogen.sh --prefix="${DEST_INSTALL}" --with-only-libndpi
|
||||
${MAKE_PROGRAM} install
|
||||
|
||||
rm -f "${LOCKFILE}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue