diff options
-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 |