Also, fix the README because the directory it specifies is wrong.

Signed-off-by: Ben Lipton <[email protected]>
---
 README.rst                                 |    6 +++---
 instance-p2v-target/hooks/install-fixes.in |   11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/README.rst b/README.rst
index f30f650..280c833 100644
--- a/README.rst
+++ b/README.rst
@@ -103,9 +103,9 @@ transfer. Generate the keys, with no passphrase, using the 
command::
 
   ssh-keygen -t dsa -N ""
 
-Place the public key in ``/etc/ganeti/instance-p2v/id_dsa.pub`` and copy
-it to all nodes. Keep the private key somewhere safe, and give it to
-users who wish to use the P2V system.
+Place the public key in ``/etc/ganeti/instance-p2v-target/id_dsa.pub``
+and copy it to all nodes. Keep the private key somewhere safe, and give
+it to users who wish to use the P2V system.
 
 
 Creating a Target Instance
diff --git a/instance-p2v-target/hooks/install-fixes.in 
b/instance-p2v-target/hooks/install-fixes.in
index 1f2abe1..b913f0f 100644
--- a/instance-p2v-target/hooks/install-fixes.in
+++ b/instance-p2v-target/hooks/install-fixes.in
@@ -17,4 +17,15 @@ fi
 mkdir -p "$TARGET/usr/lib/ganeti"
 cp -r "@configdir@/fixes" "$TARGET/usr/lib/ganeti"
 
+# Copy the public key from @configdir@/id_dsa.pub to the instance:
+if [ ! -f "@configdir@/id_dsa.pub" ]; then
+    echo "No public key found, you will not be able to log into the instance."
+    echo "Please generate a dsa keypair and place the public key in"
+    echo "@configdir@/id_dsa.pub"
+    exit 1
+fi
+
+mkdir -p "$TARGET/root/.ssh"
+cp "@configdir@/id_dsa.pub" "$TARGET/root/.ssh/authorized_keys"
+
 exit 0
-- 
1.7.3.1

Reply via email to