-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·186 lines (141 loc) · 4.02 KB
/
configure
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#! /bin/sh
# Functions
function add_symbolic_link() {
ln -s $1 $2
if [ $? -eq 0 ]; then
echo "Added: $2 -> $1"
else
echo "Add failed: $2 -> $1"
exit 1
fi
}
function remove_symbolic_link() {
rm -rf $1
if [ $? -eq 0 ]; then
echo "Removed: $1"
else
echo "Remove failed: $1"
exit 1
fi
}
function add_if_not_exists() {
if ! brew list $1 > /dev/null 2>&1; then
brew install $1
if [ ! $? -eq 0 ]; then exit 1 ;fi
brew link $1 --force
echo "Installed: $1"
else
echo "Already installed: $1"
fi
}
function add_cask_if_not_exists() {
if ! brew cask list $1 > /dev/null 2>&1; then
brew cask install $1
if [ ! $? -eq 0 ]; then exit 1 ;fi
echo "Installed (Cask): $1"
else
echo "Already installed (Cask): $1"
fi
}
# Confirm
if [ -L ~/.zsh ] || [ -L ~/.zshrc ] || [ -L ~/.vim ] || [ -L ~/.vimrc ] || [ -L ~/.tmux ] || [ -L ~/.tmux.conf ] || [ -L ~/Library/Application\ Support/Code/User/settings.json ] ||
[ -a ~/.zsh ] || [ -a ~/.zshrc ] || [ -a ~/.vim ] || [ -a ~/.vimrc ] || [ -a ~/.tmux ] || [ -a ~/.tmux.conf ] || [ -a ~/Library/Application\ Support/Code/User/settings.json ]; then
read -p "The file exists. Do you want to overwrite it ? [y/N]: " yn </dev/tty
case "$yn" in [yY]*) ;; *) exit ;; esac
remove_symbolic_link ~/.zsh
remove_symbolic_link ~/.zshrc
remove_symbolic_link ~/.vim
remove_symbolic_link ~/.vimrc
remove_symbolic_link ~/.tmux
remove_symbolic_link ~/.tmux.conf
remove_symbolic_link ~/Library/Application\ Support/Code/User/settings.json
echo
fi
# Git
echo "* Git: Clone"
if [ -d ~/.dotfiles ]; then
read -p "The folder (~/.dotfiles) exists. Do you want to overwrite it ? [y/N]: " yn </dev/tty
case "$yn" in [yY]*) ;; *) exit ;; esac
rm -rf ~/.dotfiles
fi
git clone [email protected]:calmery/Dotfiles.git ~/.dotfiles --recursive
echo "Added ~/.dotfiles"
TMUX_PATH=~/.dotfiles/tmux
VIM_PATH=~/.dotfiles/vim
VSCODE_PATH=~/.dotfiles/vscode
ZSH_PATH=~/.dotfiles/zsh
echo
# Homebrew
echo "* Homebrew: Install"
if ! type brew > /dev/null 2>&1; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
if [ ! $? -eq 0 ]; then exit 1 ;fi
else
echo "Already installed"
fi
echo
echo "* Homebrew: Update"
brew update
echo
# Install Packages
brew tap homebrew/cask-fonts
add_if_not_exists zsh
add_if_not_exists vim
add_if_not_exists tmux
add_if_not_exists zplug
add_if_not_exists n
add_if_not_exists pyenv
add_if_not_exists rbenv
add_if_not_exists exa
add_if_not_exists reattach-to-user-namespace
add_cask_if_not_exists google-chrome
add_cask_if_not_exists firefox
add_cask_if_not_exists slack
add_cask_if_not_exists discord
add_cask_if_not_exists visual-studio-code
add_cask_if_not_exists font-fira-code
echo
## Symbolic Links
echo "* Zsh: Create symbolic links"
add_symbolic_link $ZSH_PATH/.zsh ~/.zsh
add_symbolic_link $ZSH_PATH/.zshrc ~/.zshrc
echo
# Vim
echo "* Vim: Create symbolic links"
add_symbolic_link $VIM_PATH/.vim ~/.vim
add_symbolic_link $VIM_PATH/.vimrc ~/.vimrc
echo
# tmux
echo "* tmux: Create symbolic links"
add_symbolic_link $TMUX_PATH/.tmux ~/.tmux
add_symbolic_link $TMUX_PATH/.tmux.conf ~/.tmux.conf
echo
# VSCode
echo "* VSCode: Install extensions"
code --install-extension shardulm94.trailing-spaces
code --install-extension ionutvmi.path-autocomplete
code --install-extension max-ss.cyberpunk
code --install-extension coenraads.bracket-pair-colorizer
code --install-extension aaron-bond.better-comments
code --install-extension editorconfig.editorconfig
code --install-extension wraith13.bracket-lens
echo "* VSCode: Create symbolic links"
ln -s $VSCODE_PATH/settings.json ~/Library/Application\ Support/Code/User/settings.json
echo
# Memo
echo "Memo"
echo
echo "Terminal:"
echo " Change profile to Solarized Dark."
echo " Change font to Fira Code Retina 11pt."
echo
echo "zsh:"
echo " please run the following command."
echo " echo $(which zsh) >> /etc/shells"
echo " chsh -s $(which zsh)"
echo
echo "Configured."
echo
echo "Please run \`source ~/.zshrc\`"
# Exit
exit 0