From cdea4d9d46db12a2d11dd36f6ba44f42f12b3ca4 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 16 Mar 2017 16:39:58 -0300 Subject: Default image image location --- TODO.md | 1 - kvmx | 12 +++++++++++- kvmxfile | 2 +- 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" -- cgit v1.2.3