summaryrefslogtreecommitdiffstats
path: root/mcp/scripts/lib.sh
diff options
context:
space:
mode:
authorMichael Polenchuk <mpolenchuk@mirantis.com>2017-08-30 05:31:23 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-08-30 05:31:23 +0000
commit7a38c0d5f2b544bea0b5bcf755747f1fd04e5814 (patch)
tree278e83094cf8f70548a49a096e6a458fc305273b /mcp/scripts/lib.sh
parentda551c09038403de443d2eb563c91f42ad4d0f22 (diff)
parent64a9b893947329028bf0ef57379372e7d0de43e9 (diff)
Merge "lib.sh: Reuse /tmp/mcp.rsa if present"
Diffstat (limited to 'mcp/scripts/lib.sh')
-rw-r--r--mcp/scripts/lib.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 1b439a93e..3f740589d 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/
}