summaryrefslogtreecommitdiffstats
path: root/ttcn3-tcpdump-stop.sh
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-03-18 14:18:31 +0100
committerMax <msuraev@sysmocom.de>2019-03-19 10:28:46 +0000
commit81487c8b36be124b25dd725d06e3dde7dc3cc5f4 (patch)
treeaf5f1e0f0a15ed7a7dce3bd24fde050d53a10a88 /ttcn3-tcpdump-stop.sh
parent59e0c6f764138c835d0e2f336f950440e510db96 (diff)
Use dumpcap for ttcn3-tcpdump-*.sh if available
Check if dumpcap is installed (either as suid or with appropriate capabilities) and use it for packet capture instead of 'sudo tcpdump' if available. This makes it easier to use TTCN-3 testsuite as regular user without altering sudoers. Change-Id: I77df04d51a469c924cf727f0596cc33565909746
Diffstat (limited to 'ttcn3-tcpdump-stop.sh')
-rwxr-xr-xttcn3-tcpdump-stop.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
index f53cf5d..c1ab9d0 100755
--- a/ttcn3-tcpdump-stop.sh
+++ b/ttcn3-tcpdump-stop.sh
@@ -32,7 +32,8 @@ do
done
if [ -e $PIDFILE ]; then
- if [ "$(id -u)" = "0" ]; then
+ DUMPER="$(ps -q "$(cat "$PIDFILE")" -o comm=)"
+ if [ "$DUMPER" != "sudo" ]; then
kill "$(cat "$PIDFILE")"
else
# NOTE: This requires you to be root or something like