diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-04-21 18:00:37 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-04-21 18:00:37 -0300 |
commit | 77d9d6a562edc0c5c02b55bdeddba980076a6147 (patch) | |
tree | 4da531ab7eec65f88f721a768a3cb2084303de3e | |
parent | 084ca5376f8f1e535f761d29f29a3b896ebcf5d1 (diff) | |
download | kvmx-77d9d6a562edc0c5c02b55bdeddba980076a6147.tar.gz kvmx-77d9d6a562edc0c5c02b55bdeddba980076a6147.tar.bz2 |
Fix kvmx clone
-rwxr-xr-x | kvmx | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -141,6 +141,11 @@ function __kvmx_initialize { fi fi + if [ ! -h "$GLOBAL_USER_CONFIG_FOLDER/$VM" ]; then + echo "error: $GLOBAL_USER_CONFIG_FOLDER/$VM is not a symlink" + exit 1 + fi + # Box and folder config KVMXFILE="`readlink $GLOBAL_USER_CONFIG_FOLDER/$VM`" KVMX_PROJECT_FOLDER="`dirname $KVMXFILE`" @@ -653,8 +658,14 @@ function kvmx_clone { # Update config file new_image="$FOLDER/`basename $image`" - sed -i -e "s|image=\"$image\"|image=\"$new_image\"|g" $GLOBAL_USER_CONFIG_FOLDER/$DEST - sed -i -e "s|hostname=\"$VM\"|hostname=\"$DEST\"|g" $GLOBAL_USER_CONFIG_FOLDER/$DEST + sed -i -e "s|image=\"$image\"|image=\"$new_image\"|g" $FOLDER/kvmxfile + sed -i -e "s|hostname=\"$VM\"|hostname=\"$DEST\"|g" $FOLDER/kvmxfile + + # Rename keypair if exists + if [ -e "$FOLDER/ssh/$VM.key" ]; then + mv $FOLDER/ssh/$VM.key $FOLDER/ssh/$DEST.key + mv $FOLDER/ssh/$VM.key.pub $FOLDER/ssh/$DEST.key.pub + fi } # Edit guest config |