summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0022-lib.sh-Reuse-tmp-mcp.rsa-if-present.patch
blob: 75ea9355834667768365450b30cfef06720151a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Copyright (c) 2017 Enea AB and others.
:
: All rights reserved. This program and the accompanying materials
: are made available under the terms of the Apache License, Version 2.0
: which accompanies this distribution, and is available at
: http://www.apache.org/licenses/LICENSE-2.0
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Tue, 29 Aug 2017 02:35:37 +0200
Subject: [PATCH] lib.sh: Reuse /tmp/mcp.rsa if present

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 mcp/scripts/lib.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index bf8eb12..5389ced 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -9,6 +9,11 @@ generate_ssh_key() {
     user=${SUDO_USER}
   fi

+  if [ -f "/tmp/${SSH_KEY}" ]; then
+    cp "/tmp/${SSH_KEY}" .
+    ssh-keygen -f "${SSH_KEY}" -y > "${SSH_KEY}.pub"
+  fi
+
   [ -f "${SSH_KEY}" ] || ssh-keygen -f "${SSH_KEY}" -N ''
   install -o "${user}" -m 0600 "${SSH_KEY}" /tmp/
 }