contrib/test/run-in-ns.sh
raw| 1 | #!/bin/sh |
| 2 | |
| 3 | # small helper script to run the specified command inside a network |
| 4 | # namespace while remapping the real PID to root inside the namespace, |
| 5 | # so the program inside the namespace can do things like setting |
| 6 | # interface addresses |
| 7 | |
| 8 | if [ $# -eq 0 ]; then |
| 9 | echo "You have to specify the command you want to execute in the new namespace" |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
| 13 | unshare --map-root-user --user -i -m -p -f -u -U -n $1 |