Generalize ttcn3-tcpdump-*.sh

Prepare for supporting alternative packet dumpers:
* reword comments
* rename pidfile
* move tcpdump-specific option inside if
* move comment about sudo closer to actual sudo invocation

Those are cosmetic changes which do not affect how packet dump is made
but makes it easier to support alternative packet dumpers in follow-up
commit.

Change-Id: Ib2528db65348c0422fe8b7c7c53656fbce4f6405
diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh
index baabefe..f53cf5d 100755
--- a/ttcn3-tcpdump-stop.sh
+++ b/ttcn3-tcpdump-stop.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-PIDFILE=/tmp/tcpdump.pid
+PIDFILE=/tmp/dumper.pid
 TESTCASE=$1
 VERDICT="$2"
 
@@ -17,14 +17,14 @@
 	TTCN3_PCAP_PATH=/tmp
 fi
 
-# Wait for up to 2 seconds if we keep receiving traffinc from tcpdump,
+# Wait for up to 2 seconds if we keep receiving traffinc from packet dumper,
 # otherwise we might lose last packets from test.
 i=0
 prev_count=-1
 count=$(stat --format="%s" "$TTCN3_PCAP_PATH/$TESTCASE.pcap")
 while [ $count -gt $prev_count ] && [ $i -lt 2 ]
 do
-	echo "Waiting for tcpdump to finish... $i (prev_count=$prev_count, count=$count)"
+	echo "Waiting for packet dumper to finish... $i (prev_count=$prev_count, count=$count)"
 	sleep 1
 	prev_count=$count
 	count=$(stat --format="%s" "$TTCN3_PCAP_PATH/$TESTCASE.pcap")
@@ -32,11 +32,11 @@
 done
 
 if [ -e $PIDFILE ]; then
-	# NOTE: This requires you to be root or something like
-	# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
 	if [ "$(id -u)" = "0" ]; then
 		kill "$(cat "$PIDFILE")"
 	else
+	# NOTE: This requires you to be root or something like
+	# "laforge ALL=NOPASSWD: /usr/sbin/tcpdump, /bin/kill" in your sudoers file
 		sudo kill "$(cat "$PIDFILE")"
 	fi
 	rm $PIDFILE