]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Adds create action, wrapper to kvmx-create
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 13 Jun 2018 21:48:48 +0000 (18:48 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 13 Jun 2018 21:48:48 +0000 (18:48 -0300)
kvmx

diff --git a/kvmx b/kvmx
index b00c747b57695e70f91350ac87ee12dc833855b6..f861fdcb7cc777405f0b9f94131374143f63bb4e 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -366,7 +366,7 @@ function kvmx_up {
       fi
     else
       local wait="y"
-      kvmx-create $GLOBAL_USER_CONFIG_FOLDER/$VM
+      kvmx_create
     fi
 
     if [ "$wait" == "y" ]; then
@@ -1849,6 +1849,16 @@ function kvmx_xrandr {
   echo DISPLAY=:0 xrandr --output  $xrandr_device --mode $name | kvmx_ssh
 }
 
+# Wrapper to kvmx-create
+function kvmx_create {
+  if kvmx_running || kvmx_suspended; then
+    echo "$BASENAME: guest $VM is running or suspended, cannot (re-)create"
+    exit 1
+  fi
+
+  kvmx-create $KVMXFILE
+}
+
 # Dispatch
 if type kvmx_$ACTION 2> /dev/null | grep -q "kvmx_$ACTION ()"; then
   __kvmx_initialize $*