From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 2/2] doc/demo: Clone and use mbuto in init namespace Date: Sat, 17 Sep 2022 01:55:19 +0200 Message-ID: <20220916235519.2399943-3-sbrivio@redhat.com> In-Reply-To: <20220916235519.2399943-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4695968940306585536==" --===============4695968940306585536== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable ...and not in pasta's namespace: the fakeroot(1) version shipping with (at least) Fedora 36 assumes "nested" operation as it sees that the UID is 0, and claims it's not supported. Signed-off-by: Stefano Brivio --- doc/demo.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/doc/demo.sh b/doc/demo.sh index f704ed4..ed71ffb 100755 --- a/doc/demo.sh +++ b/doc/demo.sh @@ -128,6 +128,19 @@ start_pasta_delayed() { exit 0 } =20 +# start_mbuto_delayed() - Run mbuto once, and if, $DEMO_DIR/mbuto.wait is go= ne +start_mbuto_delayed() { + trap '' EXIT + while [ -d "${DEMO_DIR}/mbuto.wait" ]; do sleep 1; done + cmd git -C "${DEMO_DIR}" clone git://mbuto.sh/mbuto + echo + cmd "${DEMO_DIR}/mbuto/mbuto" \ + -p "$(realpath "${0}")" -f "${DEMO_DIR}/demo.img" + + mkdir "${DEMO_DIR}/mbuto.done" + exit 0 +} + # into_ns() - Entry point and demo script to run inside new namespace into_ns() { echo "We're in the new namespace now." @@ -204,11 +217,8 @@ into_ns() { exit 0 fi =20 - cmd git -C "${DEMO_DIR}" clone git://mbuto.sh/mbuto - echo - cmd "${DEMO_DIR}/mbuto/mbuto" \ - -p "$(realpath "${0}")" -f "${DEMO_DIR}/demo.img" - echo + rmdir "${DEMO_DIR}/mbuto.wait" + while [ ! -d "${DEMO_DIR}/mbuto.done" ]; do sleep 1; done echo "The guest image is ready. The next step will start the guest." echo "Use ^C to terminate it." next @@ -229,6 +239,7 @@ trap cleanup EXIT INT =20 DEMO_DIR=3D"$(mktemp -d)" mkdir "${DEMO_DIR}/pasta.wait" +mkdir "${DEMO_DIR}/mbuto.wait" =20 echo "This script sets up a network and user namespace using pasta(1), then" echo "starts a virtual machine in it, connected via passt(1), pausing at eve= ry" @@ -242,6 +253,7 @@ echo "of this script from there." next =20 start_pasta_delayed & +start_mbuto_delayed & DEMO_DIR=3D"${DEMO_DIR}" cmd unshare -rUn "${0}" into_ns =20 exit 0 --=20 2.35.1 --===============4695968940306585536==--