aboutsummaryrefslogtreecommitdiffstats
path: root/samples/pktgen/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'samples/pktgen/functions.sh')
-rw-r--r--samples/pktgen/functions.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/samples/pktgen/functions.sh b/samples/pktgen/functions.sh
index dae06d5b38fa..933194257a24 100644
--- a/samples/pktgen/functions.sh
+++ b/samples/pktgen/functions.sh
@@ -108,7 +108,12 @@ function pgset() {
fi
}
-[[ $EUID -eq 0 ]] && trap 'pg_ctrl "reset"' EXIT
+if [[ -z "$APPEND" ]]; then
+ if [[ $EUID -eq 0 ]]; then
+ # Cleanup pktgen setup on exit if thats not "append mode"
+ trap 'pg_ctrl "reset"' EXIT
+ fi
+fi
## -- General shell tricks --
@@ -118,7 +123,7 @@ function root_check_run_with_sudo() {
if [ "$EUID" -ne 0 ]; then
if [ -x $0 ]; then # Directly executable use sudo
info "Not root, running with sudo"
- sudo "$0" "$@"
+ sudo -E "$0" "$@"
exit $?
fi
err 4 "cannot perform sudo run of $0"