diff options
author | lmb <i@lmb.io> | 2019-05-09 09:41:22 +0100 |
---|---|---|
committer | lmb <i@lmb.io> | 2019-05-09 09:41:22 +0100 |
commit | 89d244f896020863c3666cddc5744cfdff659239 (patch) | |
tree | 7d7aa048b63f4c1f3d278a6e842403cf66251266 | |
parent | 40cec5386aedce4477d1561aa87ae580af741887 (diff) | |
download | virtme-89d244f896020863c3666cddc5744cfdff659239.tar.gz |
virtme-init: create mountpoints if they don't exist
Using a shared folder like --rwdir=/run/output=/path/on/host fails,
since the mountpoint under /run does not exist. Create the mountpoint
if it doesn't exist. Also abort the script if mounting fails.
Signed-off-by: Lorenz Bauer <i@lmb.io>
-rwxr-xr-x | virtme/guest/virtme-init | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/virtme/guest/virtme-init b/virtme/guest/virtme-init index 44a018a..f2dd878 100755 --- a/virtme/guest/virtme-init +++ b/virtme/guest/virtme-init @@ -78,7 +78,10 @@ if [[ "`stat --format=%m /dev`" != "/dev" ]]; then fi for tag in "${!virtme_initmount@}"; do - mount -t 9p -o version=9p2000.L,trans=virtio,access=any "virtme.initmount${tag:16}" "${!tag}" + if [[ ! -d "${!tag}" ]]; then + mkdir -p "${!tag}" + fi + mount -t 9p -o version=9p2000.L,trans=virtio,access=any "virtme.initmount${tag:16}" "${!tag}" || exit 1 done if [[ -n "virtme_chdir" ]]; then |