]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Default image image location
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Mar 2017 19:39:58 +0000 (16:39 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Mar 2017 19:39:58 +0000 (16:39 -0300)
TODO.md
kvmx
kvmxfile

diff --git a/TODO.md b/TODO.md
index 3a912b2c746325a54097b6f3ea62a8d8ac320c95..1c50d249349a9edef87ff635593e950149d81cf9 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -2,7 +2,6 @@ TODO
 ====
 
 * Shared folder and mountpoint pairs.
-* Default image image location so putting that info on kvmxfile is optional.
 * More kvmx-create params (ssh, serial console, etc).
 * Production mode (systemd service, serial console, no passwordless ssh, etc).
 * Support for more distros at kvmx-create (archlinux, gentoo, slackware, etc).
diff --git a/kvmx b/kvmx
index a3fd9f820a5a0ddeb12c96d80e49251a58a69645..f9a30ecefde386d564d4b60410c38af71b01a86a 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -25,6 +25,7 @@ DIRNAME="`dirname $0`"
 ACTION="$1"
 VM="$2"
 GLOBAL_USER_CONFIG_FOLDER="$HOME/.config/kvmx"
+GLOBAL_USER_CONFIG_FILE="$HOME/.config/kvmxconfig"
 
 # Set application base
 function __kvmx_set_app_base {
@@ -79,6 +80,11 @@ function __kvmx_initialize {
   # Initalize
   mkdir -p $GLOBAL_USER_CONFIG_FOLDER
 
+  # Load user config
+  if [ -e "$GLOBAL_USER_CONFIG_FILE" ]; then
+    source $GLOBAL_USER_CONFIG_FILE
+  fi
+
   # Load and check guest config
   if [ "$ACTION" != "init" ] && [ "$ACTION" != "list" ] && [ "$ACTION" != "edit" ] && [ "$ACTION" != "usage" ]; then
     if [ ! -e "$GLOBAL_USER_CONFIG_FOLDER/$VM" ]; then
@@ -89,7 +95,11 @@ function __kvmx_initialize {
     fi
 
     if [ -z "$image" ]; then
-      image="/var/cache/qemu/$VM/box.img"
+      if [ -z "$image_base" ]; then
+        image_base="$HOME/.local/share/kvmx"
+      fi
+
+      image="$image_base/$VM/box.img"
     fi
 
     # Box and folder config
index 7e5e950ccbc40be781bcf4c7b057cb3cd49b0781..2b3bfb8434a16b7c3b27dea3b3cf135f4b93ff21 100644 (file)
--- a/kvmxfile
+++ b/kvmxfile
@@ -23,7 +23,7 @@ run_spice_client="1"
 #port_mapping="hostfwd=tcp:127.0.0.1:8080-:80,hostfwd=tcp:127.0.0.1:8443-:443"
 
 # Where the guest image is stored
-image="$HOME/.local/share/kvmx/$VM/box.img"
+#image="$HOME/.local/share/kvmx/$VM/box.img"
 
 # Image size
 size="10G"