-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller
More file actions
119 lines (100 loc) · 2.69 KB
/
Copy pathinstaller
File metadata and controls
119 lines (100 loc) · 2.69 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
set -o errexit
set -o nounset
set -o xtrace
set -o pipefail
export DOTFILES_PATH="$HOME/.dotfiles"
export DOTFILES_CUSTOM_REPOSITORY="https://github.com/marydn/dotfiles.git"
echo
echo "🚀 Dotfiles installer!"
echo "-------------------------------------------------"
echo
echo "🎯 Installing basic packages"
sudo apt install -y --quiet git
echo
echo "🖊 Installing neovim"
sudo snap install --beta nvim --classic
echo
echo "🤖 Installing noobs-term"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/aaronkjones/noobs-term/master/noobs-term.sh)"
echo
echo -e '\e[0m' # Reset colors from previous scripts
echo
# make git be quiet
quiet_git() {
stdout=$(mktemp)
stderr=$(mktemp)
if ! git "$@" </dev/null >"$stdout" 2>"$stderr"; then
cat "$stderr" >&2
rm -f "$stdout" "$stderr"
exit 1
fi
rm -f "$stdout" "$stderr"
}
# backup dotfiles
backup_dotfiles() {
echo "Backing up dotfiles from installation..."
cp -rf "$DOTFILES_PATH" "$DOTFILES_PATH.backup" 2>/dev/null || :
echo "Done"
}
# install dotfiles
install_dotfiles() {
echo "Installing dotfiles into $DOTFILES_PATH..."
quiet_git clone --depth=1 "$DOTFILES_CUSTOM_REPOSITORY" "$DOTFILES_PATH"
echo "Symbolically linking dotfiles to home directory (e.g. ln -s $DOTFILES_PATH/.zshrc $HOME/.zshrc)"
find "$DOTFILES_PATH" -type f -name ".*" -exec ln -sf {} "$HOME" \; >/dev/null 2>&1
}
# remove dotfiles
remove_old_dotfiles() {
echo "Removing old dotfiles..."
rm -rf "$DOTFILES_PATH"
echo "Done"
}
config_git() {
echo " 🔭 Setting Git config"
echo
read -rp " Email : " git_email
read -rp " Name : " git_name
read -rp " Signing key : " git_key_id
echo
git config --global user.email "$git_email"
git config --global user.name "$git_name"
git config --global user.signingkey "$git_key_id"
git config --global gpg.program "$(which gpg)"
echo "Done"
}
echo
echo "🍄 Init customization"
echo "-------------------------------------------------"
echo
# backup and remove dotfiles
if [ -d "$DOTFILES_PATH" ]; then
echo "Old dotfiles exist"
echo
backup_dotfiles
echo
remove_old_dotfiles
echo
fi
# install dotfiles
install_dotfiles
echo
config_git
echo
cat "$DOTFILES_PATH/ascii.txt"
echo
echo
echo
echo " * Note: You will have to log out and back in for Zsh to be set as the default shell."
echo " If you don't want to log out now, enter 'zsh'"
echo
echo
echo ' * Press Ctrl + a, then I to load Tmux plugins'
echo
echo ' * In Gnome Terminal preferences, set Nord as your default profile'
echo ' * In iTerm, set your color profile to Nord'
echo
echo ' * Set an appropriate font (e.g. Inconsolata for Powerline)'
echo
echo
echo " 🦙 Installation completed"