CS3700-project3/scripts/create-net-ns.sh

13 lines
631 B
Bash
Raw Permalink Normal View History

2020-03-11 03:21:47 +00:00
#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
cd $(dirname $DIR)
sudo unshare -n capsh --caps="cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" --keep=1 \
--user=$USER --addamb=cap_net_admin \
-- -c "export PATH=$PWD/.netsim:\$PATH; export HOME=$PWD; /usr/bin/ip link set lo up; netsim; \
2020-03-11 03:53:51 +00:00
export PERL5LIB=\"/home/$USER/perl5/lib/perl5\${PERL5LIB:+:\${PERL5LIB}}\" \
export PERL_LOCAL_LIB_ROOT=\"/home/$USER/perl5\${PERL_LOCAL_LIB_ROOT:+:\${PERL_LOCAL_LIB_ROOT}}\" \
tc qdisc show dev lo; cd .netsim; /bin/bash --init-file <(echo unset HISTFILE)"
2020-03-11 03:21:47 +00:00
true