diff options
Diffstat (limited to 'kvmx')
-rwxr-xr-x | kvmx | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -56,6 +56,11 @@ function __kvmx_set_app_base { fi } +# Build a SSH command +function __kvmx_ssh_command { + SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -i $1" +} + # Initialize function __kvmx_initialize { __kvmx_set_app_base @@ -118,7 +123,7 @@ function __kvmx_initialize { SSHKEY="$APP_BASE/share/ssh/insecure_private_key" fi - SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -i $SSHKEY" + __kvmx_ssh_command $SSHKEY mkdir -p $STATE_DIR @@ -181,6 +186,7 @@ function kvmx_up { if [ ! -z "$basebox" ]; then if [ -e "$GLOBAL_USER_CONFIG_FOLDER/$basebox" ]; then baseimage="`kvmx list_image $basebox`" + basekey="`basename $baseimage .img`.key" if [ ! -e "$baseimage" ]; then echo "$BASENAME: could not find basebox $baseimage. Please create it first." @@ -189,6 +195,15 @@ function kvmx_up { echo "Copying base image $baseimage to $image..." cp $baseimage $image + + if [ -e "$basekey" ]; then + imagekey="`basename $image .img`.key" + cp $basekey $imagekey + cp $basekey.pub $imagekey.pub + + # Re-evaluate this if there's a custom SSH key. + __kvmx_ssh_command $basekey + fi fi else kvmx-create $GLOBAL_USER_CONFIG_FOLDER/$VM |