]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Clone: if dest is given without a full path, clone to the same basedir
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 2 Jun 2017 21:36:43 +0000 (18:36 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 2 Jun 2017 21:36:43 +0000 (18:36 -0300)
kvmx

diff --git a/kvmx b/kvmx
index 9542249e00db13cb4da4559210f8f81ee5b8bb7f..29e56618060d26fe1527a3f9025097d45e7562a1 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -430,7 +430,7 @@ function kvmx_usage {
   echo ""
   echo -e "\t$BASENAME list"
   echo -e "\t$BASENAME init  <machine>    [folder]"
-  echo -e "\t$BASENAME clone <orig-guest> <dest-folder>"
+  echo -e "\t$BASENAME clone <orig-guest> <dest-guest-or-folder>"
   echo -e "\t$BASENAME ssh   <machine>    -X firefox"
   echo ""
 
@@ -709,6 +709,13 @@ function kvmx_clone {
     kvmx_usage
   fi
 
+  # If dest is given without a full path, clone to the same basedir
+  # as the original guest.
+  if [ "$FOLDER" == "$DEST" ]; then
+    FOLDER="`dirname $image`"
+    FOLDER="`dirname $FOLDER`/$DEST"
+  fi
+
   # Check if dest machine exists
   if [ -e "$GLOBAL_USER_CONFIG_FOLDER/$DEST" ]; then
     echo "$BASENAME: destination guest $DEST already exists."