-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·53 lines (40 loc) · 934 Bytes
/
bootstrap.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
base_ssh_dir="$HOME/.ssh"
install_brew () {
echo "Installing Brew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
}
init_ssh_dir () {
if [ -z "$1" ]; then
return
fi
local name=$1
echo "Creating ssh $name directory"
mkdir -p "$base_ssh_dir/$name"
chmod 700 "$base_ssh_dir/$name"
}
init_service_ssh_key () {
if [ -z "$1" ]; then
return
fi
local service=$1
echo "Init ssh keys for $service"
until [ -n "$email" ]; do
echo -n "Email: "
read email
done
echo "Generating key for $service with $email"
ssh-keygen -t ed25519 -C "$email" -f "$base_ssh_dir/$service" -q -N ""
}
init_default_ssh_key () {
echo "Generating default rsa key"
ssh-keygen -f "$base_ssh_dir/id_rsa" -q -N ""
}
init_ssh () {
init_ssh_dir "home"
init_ssh_dir "work"
init_service_ssh_key "github"
init_default_ssh_key
}
install_brew
init_ssh