From 03c040f8860fad4bface12dd59a987d0f779fc3e Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Mon, 6 Jan 2020 15:01:52 +0300 Subject: [PATCH] Try automatic project sharing with LXD conainer over 9p filesystem. https://github.com/yakshaveinc/linux/issues/32 More work needs to be done to make it work with remote containers by reusing LXD connection. --- bin/lxd-runin.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/lxd-runin.sh b/bin/lxd-runin.sh index 96de737..7d76e7b 100755 --- a/bin/lxd-runin.sh +++ b/bin/lxd-runin.sh @@ -15,7 +15,15 @@ then else echo "Creating container '$NAME' ($OSTORUN)" lxc launch "images:$OSTORUN" "$NAME" - lxc config device add "$NAME" "$NAME-shared" disk source="$PWD" path="/root/$NAME" + if [[ ! -e ~/go/bin/ufs ]]; then + echo "Mounting $PWD as /root/$NAME read-only" + lxc config device add "$NAME" "$NAME-shared" disk source="$PWD" path="/root/$NAME" + else + echo "Sharing writeable $PWD as /root/$NAME" + lxc config device add IPython shared9p proxy listen=tcp:127.0.0.1:3333 connect=tcp:127.0.0.1:3333 bind=host + echo "Install https://github.com/aperezdc/9pfuse and " + echo "run `9pfuse -D 127.0.0.1:3333 /root/$NAME` on guest." + fi fi # https://stackoverflow.com/questions/7120426/how-to-invoke-bash-run-commands-inside-the-new-shell