aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx41
1 files 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 <<EOF
@@ -139,23 +164,11 @@ function kvmx_up {
# Remove old hostname from hosts file
if [ "\$OLD_HOST" != "$hostname.$domain" ]; then
if grep -q \$OLD_HOST /etc/hosts; then
- sudo sed -i -e '|\$OLD_HOST|d' /etc/hosts
+ sudo sed -i -e "/\$OLD_HOST/d" /etc/hosts
fi
fi
##### END REMOTE SCRIPT #######
EOF
-
- # 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
-
- 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
}
# Display usage