diff options
author | Toni <matzeton@googlemail.com> | 2023-11-06 13:25:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 13:25:49 +0100 |
commit | 93498fff02c5edecff102d895f5cd239cb1504a2 (patch) | |
tree | 950b8c4da0b3af990690fee16cce17421a32b3b9 /scripts | |
parent | 1b679271693a17ce0b653b9ba45db77b731db42e (diff) |
Apple/BSD port (#30)
* Add MacOS to Github CI builds.
* Fixed libnDPI-4.8 CI build.
* Fixed missing include for `struct sockaddr*`.
* Reworked IPv4 address and netmask retrieval.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/daemon.sh | 24 | ||||
-rwxr-xr-x | scripts/get-and-build-libndpi.sh | 6 |
2 files changed, 24 insertions, 6 deletions
diff --git a/scripts/daemon.sh b/scripts/daemon.sh index 74e9ffde0..30b3c5c00 100755 --- a/scripts/daemon.sh +++ b/scripts/daemon.sh @@ -27,7 +27,15 @@ if [ -r "${NROOT}/nDPId-${NSUFFIX}.pid" -o -r "${NROOT}/nDPIsrvd-${NSUFFIX}.pid" if [ x"${nDPId_PID}" != x ]; then sudo kill "${nDPId_PID}" 2>/dev/null || true - while ps -p "${nDPId_PID}" > /dev/null; do sleep 1; done + + MAX_TRIES=10 + while ps -p "${nDPId_PID}" > /dev/null; do + test ${MAX_TRIES} -gt 0 || break + sleep 1 + MAX_TRIES=$((MAX_TRIES - 1)) + done + test ${MAX_TRIES} -eq 0 && { RETVAL=1; printf '%s\n' 'Error: nDPId not started' >&2; } + rm -f "${NROOT}/nDPId-${NSUFFIX}.pid" else printf '%s\n' "${1} not started .." >&2 @@ -36,7 +44,15 @@ if [ -r "${NROOT}/nDPId-${NSUFFIX}.pid" -o -r "${NROOT}/nDPIsrvd-${NSUFFIX}.pid" if [ x"${nDPIsrvd_PID}" != x ]; then kill "${nDPIsrvd_PID}" 2>/dev/null || true - while ps -p "${nDPIsrvd_PID}" > /dev/null; do sleep 1; done + + MAX_TRIES=10 + while ps -p "${nDPIsrvd_PID}" > /dev/null; do + test ${MAX_TRIES} -gt 0 || break + sleep 1 + MAX_TRIES=$((MAX_TRIES - 1)) + done + test ${MAX_TRIES} -eq 0 && { RETVAL=1; printf '%s\n' 'Error: nDPIsrvd not started' >&2; } + rm -f "${NROOT}/nDPIsrvd-${NSUFFIX}.pid" "${NROOT}/nDPIsrvd-${NSUFFIX}-collector.sock" "${NROOT}/nDPIsrvd-${NSUFFIX}-distributor.sock" else printf '%s\n' "${2} not started .." >&2 @@ -54,14 +70,14 @@ else sleep 0.5 MAX_TRIES=$((MAX_TRIES - 1)) done - test ${MAX_TRIES} -eq 0 && RETVAL=1 + test ${MAX_TRIES} -eq 0 && { RETVAL=1; printf '%s\n' 'Error: nDPIsrvd collector socket not available' >&2; } MAX_TRIES=10 while [ ! -S "${NROOT}/nDPIsrvd-${NSUFFIX}-distributor.sock" -a ${MAX_TRIES} -gt 0 ]; do sleep 0.5 MAX_TRIES=$((MAX_TRIES - 1)) done - test ${MAX_TRIES} -eq 0 && RETVAL=1 + test ${MAX_TRIES} -eq 0 && { RETVAL=1; printf '%s\n' 'Error: nDPIsrvd distributor socket not available' >&2; } sudo chgrp "$(id -n -g "${NUSER}")" "${NROOT}/nDPIsrvd-${NSUFFIX}-collector.sock" test $? -eq 0 || RETVAL=1 diff --git a/scripts/get-and-build-libndpi.sh b/scripts/get-and-build-libndpi.sh index be17f7687..2d0939538 100755 --- a/scripts/get-and-build-libndpi.sh +++ b/scripts/get-and-build-libndpi.sh @@ -32,7 +32,9 @@ if [ ! -z "${CC}" ]; then fi if [ ! -z "${MAKEFLAGS}" ]; then - MAKEFLAGS="-${MAKEFLAGS}" + case "$(uname -s)" in + Linux*) MAKEFLAGS="-${MAKEFLAGS}" ;; + esac fi cat <<EOF @@ -102,7 +104,7 @@ MAKE_PROGRAM="${MAKE_PROGRAM:-make -j4}" HOST_ARG="--host=${HOST_TRIPLET}" ./autogen.sh --enable-option-checking=fatal \ --prefix="/" \ - --with-only-libndpi ${HOST_ARG} ${ADDITIONAL_ARGS} + --with-only-libndpi ${HOST_ARG} ${ADDITIONAL_ARGS} || { cat config.log | grep -v '^|'; false; } ${MAKE_PROGRAM} ${MAKEFLAGS} install DESTDIR="${DEST_INSTALL}" rm -f "${LOCKFILE}" |