- def prepare_ssh
- env[:vm].config.vm.share_folder("ssh", "#{tmp_root}/ssh", "~/.ssh")
- end
-
- def prepare_git
- `mkdir -p #{tmp_root}/git`
- `cp ~/.gitconfig #{tmp_root}/git/`
- env[:vm].config.vm.share_folder("git", "#{tmp_root}/git/", "#{tmp_root}/git")
- end
-
- def provision_git(channel)
- puts "Copying your gitconfig"
- channel.execute("cp #{tmp_root}/git/.gitconfig ~/")
- end
-
- def provision_ssh(channel)
- puts "Copying your ssh keys and config"
- channel.sudo("mkdir -p #{tmp_root}/cached && chown -R vagrant #{tmp_root}/cached")
- channel.execute("[[ -f #{user_home}/.ssh/authorized_keys ]] && mv #{user_home}/.ssh/authorized_keys #{tmp_root}/cached")
- channel.execute("cp #{tmp_root}/ssh/* #{user_home}/.ssh")
- channel.execute("cat #{tmp_root}/cached/authorized_keys >> #{user_home}/.ssh/authorized_keys") # So that `vagrant ssh` doesn't ask for password
- end
-