diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-02-04 17:24:14 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-02-04 17:24:14 +0100 |
commit | a5d4a5156f1cc33068095ed5ba8cfb4c5557150f (patch) | |
tree | 53ac94bb4fb84c870528649ab97942daf3d3a63e /slirp4netns.sh | |
parent | 70c05e678ec38e9f102212d65aab00a874911dac (diff) | |
download | passt-a5d4a5156f1cc33068095ed5ba8cfb4c5557150f.tar passt-a5d4a5156f1cc33068095ed5ba8cfb4c5557150f.tar.gz passt-a5d4a5156f1cc33068095ed5ba8cfb4c5557150f.tar.bz2 passt-a5d4a5156f1cc33068095ed5ba8cfb4c5557150f.tar.lz passt-a5d4a5156f1cc33068095ed5ba8cfb4c5557150f.tar.xz passt-a5d4a5156f1cc33068095ed5ba8cfb4c5557150f.tar.zst passt-a5d4a5156f1cc33068095ed5ba8cfb4c5557150f.zip |
slirp4netns: Look up pasta command, exit if not found
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'slirp4netns.sh')
-rwxr-xr-x | slirp4netns.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/slirp4netns.sh b/slirp4netns.sh index de74281..e6a6049 100755 --- a/slirp4netns.sh +++ b/slirp4netns.sh @@ -17,7 +17,10 @@ PASTA_PID="$(mktemp)" PASTA_OPTS="-q --ipv4-only -a 10.0.2.0 -n 24 -g 10.0.2.2 -m 1500 --no-ndp --no-dhcpv6 --no-dhcp -P ${PASTA_PID}" +PASTA="$(command -v ./pasta || command -v pasta || :)" + USAGE_RET=1 +NOTFOUND_RET=127 # add() - Add single option to $PASTA_OPTS # $1: Option name, with or without argument @@ -161,6 +164,8 @@ no_map_gw=0 EFD=0 RFD=0 +[ -z "${PASTA}" ] && echo "pasta command not found" && exit ${NOTFOUND_RET} + while getopts ce:r:m:6a:hv-: OPT 2>/dev/null; do if [ "${OPT}" = "-" ]; then OPT="${OPTARG%%[= ]*}" @@ -198,7 +203,7 @@ if [ ${v6} -eq 1 ]; then add "-a $(gen_addr6) -g fd00::2 -D fd00::3" fi -./pasta ${PASTA_OPTS} ${ns_spec} 2>/dev/null && \ +${PASTA} ${PASTA_OPTS} ${ns_spec} && \ [ ${RFD} -ne 0 ] && echo "1" >&${RFD} trap "kill $(cat ${PASTA_PID}); rm ${PASTA_PID}" INT TERM |