From 107d51ec43ea123c098fca09175a5c2fa2476a67 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 2 Jun 2017 18:36:43 -0300 Subject: Clone: if dest is given without a full path, clone to the same basedir --- kvmx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kvmx b/kvmx index 9542249..29e5661 100755 --- a/kvmx +++ b/kvmx @@ -430,7 +430,7 @@ function kvmx_usage { echo "" echo -e "\t$BASENAME list" echo -e "\t$BASENAME init [folder]" - echo -e "\t$BASENAME clone " + echo -e "\t$BASENAME clone " echo -e "\t$BASENAME ssh -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." -- cgit v1.2.3