diff options
Diffstat (limited to 'dht/vnet/tcp-enter.sh')
-rwxr-xr-x | dht/vnet/tcp-enter.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dht/vnet/tcp-enter.sh b/dht/vnet/tcp-enter.sh new file mode 100755 index 00000000..970485ed --- /dev/null +++ b/dht/vnet/tcp-enter.sh | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | cmd="$@" | ||
3 | digit=0 | ||
4 | user=$(id -un) | ||
5 | cmd=${cmd:-bash} | ||
6 | tmp=/tmp/env.$$ | ||
7 | mkdir -p $tmp | ||
8 | echo $user > $tmp/USER | ||
9 | echo $HOME > $tmp/HOME | ||
10 | echo tcp$digit > $tmp/debian_chroot | ||
11 | sudo -E nsenter --net=/var/run/netns/tcpp$digit chpst -e $tmp -u $user:$user:sudo $cmd | ||
12 | rm $tmp/USER | ||
13 | rm $tmp/HOME | ||
14 | rm $tmp/debian_chroot | ||
15 | rmdir $tmp | ||