aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx28
-rwxr-xr-xkvmx-create30
2 files changed, 26 insertions, 32 deletions
diff --git a/kvmx b/kvmx
index 6a67d09..1dd0302 100755
--- a/kvmx
+++ b/kvmx
@@ -50,7 +50,7 @@ function kvmx_spice {
#spicy -h localhost -p $PORT
#remote-viewer spice://localhost:$PORT
- # Give time to boot
+ # Give time to connect
sleep 5
# Fix window titles
@@ -114,6 +114,21 @@ function kvmx_up {
if [ "$run_spice_client" == "1" ]; then
kvmx_spice
fi
+
+ echo "Waiting for machine to boot..."
+ sleep 5
+
+ # 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
@@ -152,7 +167,16 @@ function kvmx_ssh {
exit 1
fi
- shift 2
+ # Shift params according to how the program was called:
+ # either "kvmx ssh" or "kvmx ssh guest".
+ if [ "$ACTION" == "ssh" ]; then
+ if [ ! -z "$2" ]; then
+ shift 2
+ else
+ shift 1
+ fi
+ fi
+
SSH="`cat $SSHFILE`"
$SSH_COMMAND -p $SSH $SSH_LOGIN@127.0.0.1 $*
}
diff --git a/kvmx-create b/kvmx-create
index 9ffeb88..49c6e49 100755
--- a/kvmx-create
+++ b/kvmx-create
@@ -233,36 +233,6 @@ function kvmx_create_custom {
echo "Installing sudo..."
$APT_INSTALL sudo -y
echo "%sudo ALL=NOPASSWD: ALL" | $SUDO tee $WORK/etc/sudoers.d/local > /dev/null
- kvmx_sudo_run chmod 440 $WORK/etc/sudoers.d/local
-
- # Initscript
- cat <<-EOF | $SUDO tee $WORK/etc/rc.local > /dev/null
-#!/bin/sh -e
-#
-# rc.local
-#
-# This script is executed at the end of each multiuser runlevel.
-# Make sure that the script will "exit 0" on success or any other
-# value on error.
-#
-# In order to enable or disable this script just change the execution
-# bits.
-#
-# By default this script does nothing.
-
-# Somehow it is starting before DBUS and then crashing, so we try to start again
-/usr/sbin/service spice-vdagent start
-
-# Ensure file sharing between host and guest
-if [ ! -z "$shared_folder_mountpoint" ]; then
- /bin/mkdir -p $shared_folder_mountpoint
- /bin/mount -t 9p -o trans=virtio shared $shared_folder_mountpoint -oversion=9p2000.L,posixacl,cache=loose
-fi
-
-exit 0
-EOF
-
- hydra_sudo_run chmod +x $WORK/etc/rc.local
# Root password
echo 'root:root' | kvmx_sudo_run chroot $WORK/ chpasswd