From 9c9b865522dd8ce6cba31ca2179d68a1952b87c0 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 10 Mar 2017 16:25:21 -0300 Subject: Adds kvmx_hostname and misc fixes --- kvmx | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/kvmx b/kvmx index cb0e0a0..c8bbdc7 100755 --- a/kvmx +++ b/kvmx @@ -86,7 +86,7 @@ function kvmx_up { exit 1 fi - echo "Copying base image $baseimage to $image" + echo "Copying base image $baseimage to $image..." cp $baseimage $image fi else @@ -120,8 +120,33 @@ function kvmx_up { while true; do echo true | $SSH_COMMAND -o ConnectTimeout=2 -p $SSH $SSH_LOGIN@127.0.0.1 &> /dev/null && break echo -n "." + sleep 2 done echo " done." + #sleep 5 + #echo "" + + # Somehow it is starting before DBUS and then crashing, so we try to start again + echo "Ensure spice-vdagent is running..." + echo "sudo /usr/sbin/service spice-vdagent start" | kvmx_ssh + + kvmx_hostname + + if [ ! -z "$shared_folder" ] && [ ! -z "$shared_folder_mountpoint" ]; then + echo "Mounting $shared_folder on $shared_folder_mountpoint on guest..." + echo "sudo mkdir -p $shared_folder_mountpoint" | kvmx_ssh + echo "sudo mount -t 9p -o trans=virtio shared $shared_folder_mountpoint -oversion=9p2000.L,posixacl,cache=loose" | kvmx_ssh + fi + + kvmx_status +} + +# Set hostname +function kvmx_hostname { + if ! kvmx_running; then + echo "$BASENAME: guest $VM is not running" + exit 1 + fi echo "Setting hostname..." $SSH_COMMAND -o ConnectTimeout=2 -p $SSH $SSH_LOGIN@127.0.0.1 <