aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2023-05-25 10:04:37 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-05-28 00:46:58 +0200
commitd0c070a800c7577e6d437812f0d3bd976ddc475e (patch)
tree34bf1771a7ab5de4c6e2868c1d70242ce189de9b /scripts
parent8a936a507271b727f7b0907a20fbddbe85bb725e (diff)
Added CentOs and ArchLinux to the CI.
* added some additional checks in get-and-build-libndpi.sh * CMake fallback library checks Signed-off-by: lns <matzeton@googlemail.com> Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get-and-build-libndpi.sh22
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/get-and-build-libndpi.sh b/scripts/get-and-build-libndpi.sh
index 2d304c6e7..ae88cd1d1 100755
--- a/scripts/get-and-build-libndpi.sh
+++ b/scripts/get-and-build-libndpi.sh
@@ -2,8 +2,18 @@
set -e
+GIT_EXEC="$(command -v git || printf '%s' "")"
+WGET_EXEC="$(command -v wget || printf '%s' "")"
+UNZIP_EXEC="$(command -v unzip || printf '%s' "")"
+MAKE_EXEC="$(command -v make || printf '%s' "")"
+
GITHUB_FALLBACK_URL='https://github.com/ntop/nDPI/archive/refs/heads/dev.zip'
+if [ -z "${GIT_EXEC}" -o -z "${WGET_EXEC}" -o -z "${UNZIP_EXEC}" -o -z "${MAKE_EXEC}" ]; then
+ printf '%s\n' "Required Executables missing: git, wget, unzip, make" >&2
+ exit 1
+fi
+
LOCKFILE="$(realpath "${0}").lock"
touch "${LOCKFILE}"
exec 42< "${LOCKFILE}"
@@ -35,10 +45,13 @@ EOF
set -x
cd "$(dirname "${0}")/.."
+
+GIT_SUCCESS=0
if [ -d ./.git -o -f ./.git ]; then
- LINES_CHANGED="$(git --no-pager diff ./libnDPI | wc -l)"
+ GIT_SUCCESS=1
+ LINES_CHANGED="$(git --no-pager diff ./libnDPI 2>/dev/null | wc -l || printf '0')"
if [ ${LINES_CHANGED} -eq 0 ]; then
- git submodule update --progress --init ./libnDPI
+ git submodule update --progress --init ./libnDPI || { GIT_SUCCESS=0; true; }
else
set +x
printf '%s\n' '-----------------------------------'
@@ -46,7 +59,9 @@ if [ -d ./.git -o -f ./.git ]; then
printf '%s\n' '-----------------------------------'
set -x
fi
-else
+fi
+
+if [ ${GIT_SUCCESS} -eq 0 ]; then
set +x
printf '%s\n' '-----------------------------------'
printf 'WARNING: %s is supposed to be a GIT repository. But it is not.\n' "$(realpath $(dirname "${0}")/..)"
@@ -57,6 +72,7 @@ else
set -x
wget "${GITHUB_FALLBACK_URL}" -O ./libnDPI-github-dev.zip
unzip ./libnDPI-github-dev.zip
+ rm -rf ./libnDPI
mv ./nDPI-dev ./libnDPI
fi