-
Notifications
You must be signed in to change notification settings - Fork 3
/
install
executable file
·84 lines (62 loc) · 2.15 KB
/
install
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
#!/bin/sh
# Install symlinks from the dotfile directory to the user's homedir
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
info() {
printf "\r [ \033[00;34m..\033[0m ] $1\n"
}
user() {
printf "\r [ \033[0;33m??\033[0m ] $1\n"
}
success() {
printf "\r\033[2K [ \033[00;32mOK\033[0m ] $1\n"
}
fail() {
printf "\r\033[2K [\033[0;31mFAIL\033[0m] $1\n"
}
link() {
local src="$1"
local dst="$2"
# check if the file or directory exists
if [ -d "$dst" ] || [ -f "$dst" ]; then
# Skip linking
fail "$dst already exists; skipping..."
else
# Link the file/directory
ln -s "$src" "$dst" && success "Link from $src to $dst created"
fi
}
info "Installing Dotfiles"
mkdir "$HOME/.config"
# ---- zsh ------------------------------------------------------------
link "$dir/zsh/.zshenv" ~/.zshenv
link "$dir/zsh" ~/.zsh
touch ~/.zshrc.local
# ---- neovim ---------------------------------------------------------
link "$dir/nvim" ~/.config/nvim
# ---- alacritty ------------------------------------------------------
link "$dir/alacritty" ~/.config/alacritty
# ---- vim ------------------------------------------------------------
link "$dir/vim" ~/.vim
# ---- tmux -----------------------------------------------------------
link "$dir/tmux/tmux.conf" ~/.tmux.conf
# ---- mutt -----------------------------------------------------------
# link "$dir/mutt" ~/.mutt
# ---- git ------------------------------------------------------------
info 'setting up git'
link "$dir/git/gitignore" ~/.gitignore
link "$dir/git/gitconfig" ~/.gitconfig
if [ ! -f ~/.gitconfig.local ]; then
user ' - What is your github author name?'
read -e git_authorname
user ' - What is your github author email?'
read -e git_authoremail
sed -e "s/AUTHORNAME/$git_authorname/g" \
-e "s/AUTHOREMAIL/$git_authoremail/g" \
"$dir/git/gitconfig.local" >~/.gitconfig.local
fi
# ---- rust -----------------------------------------------------------
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo 'source "$HOME/.cargo/env"' >> $HOME/.zshrc.local
# ---- homebrew -------------------------------------------------------
"$dir/homebrew/install-homebrew"
echo " Finished!"