From 3c458174ba4d60f7114038e43dd7c85a22d6d062 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Thu, 26 Oct 2023 02:07:27 -0400 Subject: [PATCH] feat(net): add option -x to unshare network --- try | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/try b/try index a81d9ca3..584462f8 100755 --- a/try +++ b/try @@ -233,7 +233,11 @@ EOF # --pid: create a new process namespace (needed fr procfs to work right) # --fork: necessary if we do --pid # "Creation of a persistent PID namespace will fail if the --fork option is not also specified." - unshare --mount --map-root-user --user --pid --fork "$mount_and_execute" + if [ "$EXTRA_NS" = "net" ]; then + unshare --mount --map-root-user --user --pid --fork --net "$mount_and_execute" + else + unshare --mount --map-root-user --user --pid --fork "$mount_and_execute" + fi TRY_EXIT_STATUS=$? ################################################################################ @@ -476,10 +480,11 @@ error() { usage() { cat >&2 <