]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Shared folder - eval from project folder so . resolves correctly
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Mar 2017 15:48:42 +0000 (12:48 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Mar 2017 15:48:42 +0000 (12:48 -0300)
TODO.md
kvmx

diff --git a/TODO.md b/TODO.md
index 307d567fcf57ff7646ca8699798e5f906d739562..d0605c0d04037b5f77a2ff7db38f222cecfd3e0f 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -2,7 +2,6 @@ TODO
 ====
 
 * Default image image location so putting that info on kvmxfile is optional.
-* Shared folder - eval from project folder so . resolves correctly.
 * Use APP_BASE variable like the Hydra Suite (symlink handling, etc).
 * More kvmx-create params (ssh, serial console, etc).
 * Support for more distros at kvmx-create (archlinux, gentoo, slackware, etc).
diff --git a/kvmx b/kvmx
index 889a9ba80f930622d257606bb29b9fc48a73b2f4..4a347c22dc4b8ab5260acfce2b0cfd80cf128d1f 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -67,7 +67,8 @@ function kvmx_up {
   fi
 
   if [ ! -z "$shared_folder" ]; then
-    shared_folder="`cd $shared_folder &> /dev/null && pwd`"
+    # Get absolute path of shared folder relative to project path
+    shared_folder="`cd $KVMX_PROJECT_FOLDER && cd $shared_folder &> /dev/null && pwd`"
     local shared="-fsdev local,id=shared,path=$shared_folder,security_model=none -device virtio-9p-pci,fsdev=shared,mount_tag=shared"
   fi
 
@@ -356,11 +357,9 @@ function kvmx_initialize {
       image="/var/cache/qemu/$VM/box.img"
     fi
 
-    if [ -z "$KVMXFILE" ]; then
-      KVMXFILE="/var/cache/qemu/$VM/kvmxfile"
-    fi
-
     # Box and folder config
+    KVMXFILE="`readlink $GLOBAL_USER_CONFIG_FOLDER/$VM`"
+    KVMX_PROJECT_FOLDER="`dirname $KVMXFILE`"
     STORAGE="`dirname $image`"
     STATE_DIR="$STORAGE/state/$VM"
     PIDFILE="$STATE_DIR/pid"