From ec48653e10a94b01c155ef0811fe4c132ed6c79b Mon Sep 17 00:00:00 2001 From: Andrejus Date: Wed, 26 Feb 2020 20:31:12 +0000 Subject: [PATCH] add ssh keygen step --- install/02-ssh.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/install/02-ssh.sh b/install/02-ssh.sh index 1c9acd1..4ebb187 100644 --- a/install/02-ssh.sh +++ b/install/02-ssh.sh @@ -1,13 +1,22 @@ #!/usr/bin/env bash # # After running this script: -# 1. ssh-keygen is run # TODO +# 1. ssh key exists # 2. ssh dotfiles are symlinked # -# 1. ssh dotfiles are symlinked -readonly ssh_source="$dotfiles_dir/ssh" +# 1. ssh key exists readonly ssh_target="$HOME/.ssh" +readonly ssh_key="$ssh_target/id_rsa" +readonly ssh_pub="$ssh_key.pub" +if [ ! -f "$ssh_key" ]; then + printf "generating ssh key...\n" + ssh-keygen -t rsa -b 4096 -f "$ssh_key" +fi +printf "ssh key exists\n" + +# 2. ssh dotfiles are symlinked +readonly ssh_source="$dotfiles_dir/ssh" link_folder "$ssh_source" "$ssh_target" printf "ssh dotfiles are symlinked\n" -cat "$ssh_target/id_rsa.pub" +cat "$ssh_pub"