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
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 @@
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