]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Initialize the clipboard at kvmx-vdagent
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 24 Mar 2017 16:48:48 +0000 (13:48 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 24 Mar 2017 16:48:48 +0000 (13:48 -0300)
README.md
kvmx
kvmx-create
kvmx-vdagent
kvmxfile

index 5410818058d959eecfe1d3031ff8ea783a254fb3..21092a43396fa0bb13902928524a318a1b3f3e32 100644 (file)
--- a/README.md
+++ b/README.md
@@ -46,6 +46,7 @@ If no folder is specified, the current folder is assumed as the project home.
 
 ## Further development
 
+* Support for custom SSH keypair per virtual machine.
 * Remount shared folders and reinitialize spice-vdagent upon resume from disk.
 * More params (memory, cpus, ssh, serial console, additional shared folders, etc).
 * Integration with [image-bootstrap](https://github.com/hartwork/image-bootstrap).
diff --git a/kvmx b/kvmx
index a6bd52cdf47a470da3ad0272748deb6ffd6e41ec..6f9c58237d2e9ba44708357fadb1e56081073f39 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -74,7 +74,6 @@ function __kvmx_initialize {
   # Default parameters
   PORT="$(($RANDOM + 1024))"
   SSH="$(($PORT + 22))"
-  SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -i $APP_BASE/share/ssh/insecure_private_key"
   SSH_LOGIN="user"
 
   # Initalize
@@ -112,6 +111,15 @@ function __kvmx_initialize {
     SSHFILE="$STATE_DIR/ssh"
     LOGFILE="$STATE_DIR/log"
     SPICEFILE="$STATE_DIR/spice"
+
+    if [ -e "$STORAGE/$VM.key" ]; then
+      SSHKEY="$STORAGE/$VM.key"
+    else
+      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"
+
     mkdir -p $STATE_DIR
 
     if [ ! -e "$image" ] && [ "$ACTION" != "up" ] && [ "$ACTION" != "purge" ] && [ "$ACTION" != "destroy" ]; then
index d06c2b4178708efb4e1b04a030427f28eaa1a633..31646eb7ce6c3bad0c6bec40f64c1ecfbc5d821d 100755 (executable)
@@ -103,6 +103,8 @@ function kvmx_config {
   kvmx_user_config   arch              amd64                            "System arch"
   kvmx_user_config   version           stretch                          "Distro version"
   kvmx_user_config   mirror            http://http.debian.net/debian/   "Debian mirror"
+  kvmx_user_config   ssh_support       y                                "Administration using passwordless SSH (y/n)"
+  kvmx_user_config   ssh_custom        y                                "Setup a custom SSH keypair (y/n)"
 }
 
 # Load config file
index 9437a8e2203684ec4d2d8ce320ac2f0524c0d1a0..e938b7499d5dfe39689f16061f22074021416aab 100755 (executable)
@@ -30,3 +30,9 @@ done
 if which spice-vdagent &> /dev/null ; then
   spice-vdagent
 fi
+
+# Initialize the clipboard with some content: this seems necessary in order to
+# the clipboard link start working between host and guest.
+if which xclip &> /dev/null; then
+  echo $RANDOM | xclip
+fi
index 2b3bfb8434a16b7c3b27dea3b3cf135f4b93ff21..99fad1d1af3541e5ee923237f8419d58ced8b2f0 100644 (file)
--- a/kvmxfile
+++ b/kvmxfile
@@ -48,3 +48,6 @@ version="stretch"
 
 # Debian mirror
 mirror="http://http.debian.net/debian/"  
+
+ssh_support="y"
+ssh_custom="y"