forked from JDevlieghere/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·158 lines (137 loc) · 3.65 KB
/
bootstrap.sh
File metadata and controls
executable file
·158 lines (137 loc) · 3.65 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
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
#!/usr/bin/env bash
DOTFILES=$(pwd -P)
info() {
printf "\033[00;34m$@\033[0m\n"
}
doUpdate() {
info "Updating"
git pull origin master;
}
doGitConfig() {
info "Configuring Git"
# The .gitconfig will be overwritten; reconfigure it.
echo "Configuring global .gitignore"
git config --global core.excludesfile ~/.gitignore_global
# Use Araxis Merge as diff and merge tool when available.
if [ -d "/Applications/Araxis Merge.app/Contents/Utilities/" ]; then
echo "Configuring Araxis Merge"
git config --global diff.guitool araxis
git config --global merge.guitool araxis
fi
}
doSync() {
info "Syncing"
rsync --exclude ".git/" \
--exclude ".gitignore" \
--exclude "Preferences.sublime-settings" \
--exclude "README.md" \
--exclude "bootstrap.sh" \
--exclude "installers/" \
--exclude "os/" \
--exclude "scripts/" \
--exclude "tmux.terminfo" \
--filter=':- .gitignore' \
-avh --no-perms . ~;
# Copy files that have different locations on macOS and Linux.
if [ -d "$HOME/Library/Application Support/Code/User/" ]; then
cp -f "$HOME/.config/Code/User/settings.json" \
"$HOME/Library/Application Support/Code/User/settings.json"
fi
}
doSymLink() {
mkdir -p ${XDG_CONFIG_HOME:=$HOME/.config}
ln -s ~/.vim/* $XDG_CONFIG_HOME/nvim
ln -s ~/.vimrc $XDG_CONFIG_HOME/nvim/init.vim
}
doInstall() {
info "Installing Extras"
# plug.vim
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# tmux Plugin Manager
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# FZF
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
}
doFonts() {
info "Installing Fonts"
if [ "$(uname)" == "Darwin" ]; then
fonts=~/Library/Fonts
elif [ "$(uname)" == "Linux" ]; then
fonts=~/.fonts
mkdir -p "$fonts"
fi
find "$DOTFILES/fonts/" -name "*.[o,t]tf" -type f | while read -r file
do
cp -v "$file" "$fonts"
done
}
doConfig() {
info "Configuring"
if [ "$(uname)" == "Darwin" ]; then
echo "Configuring macOS"
./os/macos.sh
elif [ "$(uname)" == "Linux" ]; then
echo "Configuring Linux"
./os/linux.sh
fi
}
doAll() {
doUpdate
doSync
doGitConfig
doSymLink
doInstall
doFonts
doConfig
}
doHelp() {
echo "Usage: $(basename "$0") [options]" >&2
echo
echo " -s, --sync Synchronizes dotfiles to home directory"
echo " -l, --link Create symbolic links"
echo " -i, --install Install (extra) software"
echo " -f, --fonts Copies font files"
echo " -c, --config Configures your system"
echo " -a, --all Does all of the above"
echo
exit 1
}
if [ $# -eq 0 ]; then
doHelp
else
for i in "$@"
do
case $i in
-s|--sync)
doSync
doGitConfig
shift
;;
-l|--link)
doSymLink
shift
;;
-i|--install)
doInstall
shift
;;
-f|--fonts)
doFonts
shift
;;
-c|--config)
doConfig
shift
;;
-a|--all)
doAll
shift
;;
*)
doHelp
shift
;;
esac
done
fi