From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 01/18] slirp4netns: Look up pasta command, exit if not found Date: Tue, 22 Feb 2022 02:34:17 +0100 Message-ID: <20220222013434.4116044-2-sbrivio@redhat.com> In-Reply-To: <20220222013434.4116044-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8190650641828912471==" --===============8190650641828912471== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Stefano Brivio --- slirp4netns.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/slirp4netns.sh b/slirp4netns.sh index de74281..e6a6049 100755 --- a/slirp4netns.sh +++ b/slirp4netns.sh @@ -17,7 +17,10 @@ =20 PASTA_PID=3D"$(mktemp)" PASTA_OPTS=3D"-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=3D"$(command -v ./pasta || command -v pasta || :)" + USAGE_RET=3D1 +NOTFOUND_RET=3D127 =20 # add() - Add single option to $PASTA_OPTS # $1: Option name, with or without argument @@ -161,6 +164,8 @@ no_map_gw=3D0 EFD=3D0 RFD=3D0 =20 +[ -z "${PASTA}" ] && echo "pasta command not found" && exit ${NOTFOUND_RET} + while getopts ce:r:m:6a:hv-: OPT 2>/dev/null; do if [ "${OPT}" =3D "-" ]; then OPT=3D"${OPTARG%%[=3D ]*}" @@ -198,7 +203,7 @@ if [ ${v6} -eq 1 ]; then add "-a $(gen_addr6) -g fd00::2 -D fd00::3" fi =20 -./pasta ${PASTA_OPTS} ${ns_spec} 2>/dev/null && \ +${PASTA} ${PASTA_OPTS} ${ns_spec} && \ [ ${RFD} -ne 0 ] && echo "1" >&${RFD} =20 trap "kill $(cat ${PASTA_PID}); rm ${PASTA_PID}" INT TERM --=20 2.34.1 --===============8190650641828912471==--