From 87b7a74cf0f81cb911b9da652a30fab0bc522443 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 12 Jan 2015 01:37:11 -0500 Subject: [PATCH] Copy the id_rsa.pub key to the vm where possible This allows dokku-installer to automatically list the public key in it's UI --- Vagrantfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index d0dd434ff..2d310a943 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,6 +7,7 @@ BOX_MEMORY = ENV["BOX_MEMORY"] || "1024" DOKKU_DOMAIN = ENV["DOKKU_DOMAIN"] || "dokku.me" DOKKU_IP = ENV["DOKKU_IP"] || "10.0.0.2" PREBUILT_STACK_URL = File.exist?("#{File.dirname(__FILE__)}/stack.tgz") ? 'file:///root/dokku/stack.tgz' : nil +PUBLIC_KEY_PATH = "#{Dir.home}/.ssh/id_rsa.pub" make_cmd = "make install" if PREBUILT_STACK_URL @@ -48,4 +49,9 @@ Vagrant::configure("2") do |config| config.vm.define "build", autostart: false do |vm| vm.vm.provision :shell, :inline => "cd /root/dokku && make deb-all" end + + if Pathname.new(PUBLIC_KEY_PATH).exist? + config.vm.provision :file, source: PUBLIC_KEY_PATH, destination: '/tmp/id_rsa.pub' + config.vm.provision :shell, :inline => "rm /root/.ssh/authorized_keys && mv /tmp/id_rsa.pub /root/.ssh/authorized_keys" + end end