-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04-add-ssh-keys
More file actions
executable file
·36 lines (29 loc) · 893 Bytes
/
04-add-ssh-keys
File metadata and controls
executable file
·36 lines (29 loc) · 893 Bytes
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
34
35
36
#!/usr/bin/env bash
# sshhostkeys
if [[ ${sshHostKeyFlag:-false} == true ]]; then
log_info 'Creating ssh host key.'
else
log_info 'ssh host key skipped.'
return;
fi
# Creating a ssh host key
yay -S ssh-keygen
sshDir=~/git/ssh
mkdir -pv $sshDir
ln -fsv $sshDir ~/.ssh
ssh-keygen -f $sshDir/$HOSTNAME
# Create ssh/config from template.
template=ssh-config-template
config=$sshDir/config
cp -v "$template" "$config"
# Repace ssh-config-template/GIT-USER-NAME with
# bootstrap-archlinux/config/$gitUserName
sed -i "s/GIT-USER-NAME/$gitUserName/g" "$config"
# Repace ssh-config-template/ARCH-HOST-NAME with
# bootstrap-archlinux/config/$archHostName
sed -i "s/ARCH-HOST-NAME/$archHostName/g" "$config"
#Setting ssh permissions.
chmod 600 "$sshDir/$archHostName"
chmod 644 "$sshDir/$archHostName.pub"
# Initialize .ssh/config.
touch "$cloneRoot/ssh/config.vim"