aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2024-11-20 11:01:01 +0100
committerToni Uhlig <matzeton@googlemail.com>2024-11-20 11:01:01 +0100
commit7b91ad84584b4c61a5315731436675aae7d2fcb2 (patch)
tree9ffe16c93ad67f60efe7f1dd982d481d3a2fd28e
parent442900bc14a591ac11f2fc0c6e7c7936b4f3298a (diff)
Added script to warn a user about issues regarding wrong umask and CPack
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--CMakeLists.txt8
-rwxr-xr-xscripts/umask-check.sh14
2 files changed, 22 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d977ca20f..97939faa5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -200,6 +200,14 @@ add_executable(nDPId nDPId.c ${NDPID_PFRING_SRCS} nio.c utils.c)
add_executable(nDPIsrvd nDPIsrvd.c nio.c utils.c)
add_executable(nDPId-test nDPId-test.c ${NDPID_PFRING_SRCS})
+add_custom_target(umask_check)
+add_custom_command(
+ TARGET umask_check
+ PRE_BUILD
+ COMMAND ${CMAKE_SOURCE_DIR}/scripts/umask-check.sh
+)
+add_dependencies(nDPId umask_check)
+
add_custom_target(dist)
add_custom_command(
TARGET dist
diff --git a/scripts/umask-check.sh b/scripts/umask-check.sh
new file mode 100755
index 000000000..8c81484ad
--- /dev/null
+++ b/scripts/umask-check.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+UMASK=$(umask)
+
+if [ "${UMASK}" != "0002" -a "${UMASK}" != "0022" ]; then
+ cat <<EOF
+********************************************
+* WARNING: 'cpack -G DEB' / 'cpack -G RPM' *
+* might not work correctly due to umask, *
+* which is set to ${UMASK} *
+* but expected is either 0002 or 0022 *
+********************************************
+EOF
+fi