aboutsummaryrefslogtreecommitdiff
path: root/kvmx
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-06-02 18:36:43 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-06-02 18:36:43 -0300
commit107d51ec43ea123c098fca09175a5c2fa2476a67 (patch)
tree9bd2086229343ddbd2442bc40cd14a7786e45dde /kvmx
parenta14dd0ac67d567a90846c37fc906de134ef79a8c (diff)
downloadkvmx-107d51ec43ea123c098fca09175a5c2fa2476a67.tar.gz
kvmx-107d51ec43ea123c098fca09175a5c2fa2476a67.tar.bz2
Clone: if dest is given without a full path, clone to the same basedir
Diffstat (limited to 'kvmx')
-rwxr-xr-xkvmx9
1 files changed, 8 insertions, 1 deletions
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 <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."