aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-16 16:39:58 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-16 16:39:58 -0300
commitcdea4d9d46db12a2d11dd36f6ba44f42f12b3ca4 (patch)
tree54b31550e11507ea472257f4977cce2afbfd3fd6
parentdc567951ec5ffef0e691be57dc9fe588e3b60872 (diff)
downloadkvmx-cdea4d9d46db12a2d11dd36f6ba44f42f12b3ca4.tar.gz
kvmx-cdea4d9d46db12a2d11dd36f6ba44f42f12b3ca4.tar.bz2
Default image image location
-rw-r--r--TODO.md1
-rwxr-xr-xkvmx12
-rw-r--r--kvmxfile2
3 files changed, 12 insertions, 3 deletions
diff --git a/TODO.md b/TODO.md
index 3a912b2..1c50d24 100644
--- 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 a3fd9f8..f9a30ec 100755
--- 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
diff --git a/kvmxfile b/kvmxfile
index 7e5e950..2b3bfb8 100644
--- 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"