-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpost-install.sh
executable file
·61 lines (54 loc) · 1.7 KB
/
post-install.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
54
55
56
57
58
59
60
61
#!/data/data/com.termux/files/usr/bin/bash
## Author : Michael Haslam
## Mail : hreikin@gmail.com
## License : MIT
# Fail on error and report it, debug all lines.
set -eu -o pipefail
config_git_user () {
echo
echo "This step configures your git user.name with the following command:"
echo
echo -e "git config --global user.name \"Example Name\""
echo
read -p -r "Please enter your git user.name: " USER_NAME
git config --global user.name "$USER_NAME"
}
config_git_email () {
echo
echo "This step configures your git user.email with the following command:"
echo
echo -e "git config --global user.email \"example@example.com\""
echo
read -p -r "Please enter your git user.email: " USER_EMAIL
git config --global user.email "$USER_EMAIL"
}
config_git_editor () {
echo
echo "This step configures your git core.editor with the following command:"
echo
echo -e "git config --global core.editor \"nano\""
echo
git config --global core.editor "nano"
}
generate_ssh_key () {
echo
echo "This step generates an SSH key and adds it to the SSH agent with the following commands:"
echo
echo -e "ssh-keygen -t ed25519 -C \"example@example.com\""
echo -e "eval \"\$(ssh-agent -s)\""
echo -e "ssh-add ~/.ssh/id_ed25519"
ssh-keygen -t ed25519 -C "$USER_EMAIL"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
}
# Change to $HOME directory before starting.
cd "$HOME"
echo "This script takes care of a few common post-installation tasks such as:"
echo
echo "- Configuring git user.name"
echo "- Configuring git user.email"
echo "- Generating a default SSH key"
config_git_user
config_git_email
config_git_editor
generate_ssh_key