]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Fix: ssh pubkey file name evaluation
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 22 May 2020 14:42:04 +0000 (11:42 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 22 May 2020 14:42:04 +0000 (11:42 -0300)
kvmx
kvmx-create
kvmxfile

diff --git a/kvmx b/kvmx
index 204a25b4e13f691a80925cd8fac9545dff82a696..d380b55e2861297e54869bdd2e44532498f7daa6 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -152,7 +152,7 @@ function __kvmx_initialize {
       # hostname and no image param is set (kvmx-create puts image in one
       # place, kvmx expects in the other). So we try to guess first the image by hostname
       # and then by guest name. Note that it might be possible to have conflicts if there
-      # are machines with hostnames set to the name os other machines. But here we hope that
+      # are machines with hostnames set to the name of other machines. But here we hope that
       # the user is not messing that much ;)
       if [ ! -z "$hostname" ] && [ -e "$image_base/$hostname/box.img" ]; then
         image="$image_base/$hostname/box.img"
@@ -1274,6 +1274,7 @@ function kvmx_init {
   if [ ! -e "$FOLDER/kvmxfile" ]; then
     cp $APP_BASE/kvmxfile $FOLDER/
     sed -i -e "s|hostname=\"machine\"|hostname=\"$VM\"|g" $FOLDER/kvmxfile
+    sed -i -e "s|hostname=\"kvmx\"|hostname=\"$VM\"|g" $FOLDER/kvmxfile
   fi
 
   # Create config entry
index f1d998e27a1bc9d64e6bcc10c47581d67c582a34..f31ec5b3fcde1fe1de433f8bb594a8cba856a289 100755 (executable)
@@ -423,6 +423,9 @@ EOF
   # Initial user homedir
   kvmx_sudo_run mkdir -p $WORK/home/$user
 
+  # There might be trouble managing the guest SSH keys when project folder name is different from
+  # hostname: while kvmx-create uses $hostname to guess the pubkey file name, kvmx uses $VM.
+  # Here we hope that # the user is not messing that much ;)
   #if [ "$ssh_support" == "y" ]; then
   if [ "$ssh_custom" == "y" ]; then
     if [ ! -z "$ssh_custom_pubkey" ]; then
index eb801775e312a29c864ea25c77a5e75e5531b3b8..25f676d6c2f35fc5258721d725170b2cb5eed796 100644 (file)
--- a/kvmxfile
+++ b/kvmxfile
@@ -2,6 +2,9 @@
 # Sample kvmx file - https://kvmx.fluxo.info
 #
 
+# Hostname
+hostname="kvmx"
+
 # Which base box you should use. Leave unconfigured to use kvmx-create instead.
 #basebox="buster"
 
@@ -151,9 +154,6 @@ qcow2_compression="1"
 # Bootstrap method: custom or vmdeboostrap
 method="custom"
 
-# Hostname
-hostname="kvmx"
-
 # Domain
 domain="example.org"