-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·311 lines (253 loc) · 8.26 KB
/
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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
#!/usr/bin/env bash
set -e
set -u
###
### ./install.sh -y
###
ASK="Y"
if [ "${#}" = "1" ]; then
if [ "${1}" = "-y" ]; then
ASK="F"
fi
fi
############################################################
# Generic defines (do not edit)
############################################################
MY_PATH="$(cd -P -- "$(dirname -- "${0}")" && pwd -P)"
#MY_NAME="$( basename "${0}" )"
MY_FUNCTIONS="${MY_PATH}/.lib/functions.sh"
MY_BACKUPDIR="${HOME}/dotfiles-backup_$(date '+%Y-%m-%d_%H.%M.%S')"
############################################################
# Pre-Start
############################################################
# Source lib
# shellcheck disable=SC1090
. "${MY_FUNCTIONS}"
# Create Backup folder
if [ ! -d "${MY_BACKUPDIR}" ]; then
mkdir "${MY_BACKUPDIR}";
fi
############################################################
# Start
############################################################
###
### autorunner
###
if ask "Symlink autorunner?" "${ASK}"; then
symlink_file "${MY_PATH}/autorunner" "${HOME}/.config/autorunner" "${MY_BACKUPDIR}"
fi
###
### bash
###
if ask "Symlink bash?" "${ASK}"; then
symlink_file "${MY_PATH}/bash/bash_logout" "${HOME}/.bash_logout" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/bash/bash_profile" "${HOME}/.bash_profile" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/bash/bashrc" "${HOME}/.bashrc" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/bash/config" "${HOME}/.config/bash" "${MY_BACKUPDIR}"
if [ -f "${MY_PATH}/config" ]; then
# shellcheck disable=SC1090
. "${MY_PATH}/config"
git_ident="$( mktemp )"
i=1
(
echo "#Generated by dotfiles from ./config - do not edit"
echo "git-ident-show() {"
echo " git config --get user.name"
echo " git config --get user.email"
echo " git config --get user.signingkey"
echo "}"
) > "${git_ident}"
while [ "${i}" -le "${NUM_OF_GIT_IDENTS}" ]; do
git_alias="GIT_IDENT${i}_ALIAS"
git_name="GIT_IDENT${i}_NAME"
git_mail="GIT_IDENT${i}_MAIL"
git_gpg="GIT_IDENT${i}_GPG"
(
echo "git-ident-make-${!git_alias}() {"
echo " git config user.name \"${!git_name}\""
echo " git config user.email \"${!git_mail}\""
echo " git config user.signingkey \"${!git_gpg}\""
echo " git-ident-show"
echo "}"
) >> "${git_ident}"
i=$(( i + 1 ))
done
mv "${git_ident}" "${MY_PATH}/bash/config/bashrc.d/git-ident.bash"
fi
fi
###
### compton
###
if ask "Symlink compton?" "${ASK}"; then
symlink_file "${MY_PATH}/compton/compton.conf" "${HOME}/.config/compton.conf" "${MY_BACKUPDIR}"
fi
###
### ctags
###
if ask "Symlink ctags?" "${ASK}"; then
symlink_file "${MY_PATH}/ctags/ctags" "${HOME}/.ctags" "${MY_BACKUPDIR}"
fi
###
### dunst
###
if ask "Symlink dunst?" "${ASK}"; then
symlink_file "${MY_PATH}/dunst" "${HOME}/.config/dunst" "${MY_BACKUPDIR}"
fi
###
### git
###
if ask "Symlink gitconfig?" "${ASK}"; then
symlink_file "${MY_PATH}/git/gitconfig" "${HOME}/.gitconfig" "${MY_BACKUPDIR}"
fi
###
### gnugp
###
if ask "Symlink gnupg?" "${ASK}"; then
symlink_file "${MY_PATH}/gnupg/dirmngr.conf" "${HOME}/.gnupg/dirmngr.conf" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/gnupg/gpg.conf" "${HOME}/.gnupg/gpg.conf" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/gnupg/gpg-agent.conf" "${HOME}/.gnupg/gpg-agent.conf" "${MY_BACKUPDIR}"
fi
###
### gtk
###
if ask "Symlink gtk2/gtk3 settings?" "${ASK}"; then
symlink_file "${MY_PATH}/gtk/gtkrc-2.0" "${HOME}/.gtkrc-2.0" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/gtk/gtk-2.0" "${HOME}/.config/gtk-2.0" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/gtk/gtk-3.0" "${HOME}/.config/gtk-3.0" "${MY_BACKUPDIR}"
fi
###
### i3
###
if ask "Symlink i3?" "${ASK}"; then
symlink_file "${MY_PATH}/i3" "${HOME}/.config/i3" "${MY_BACKUPDIR}"
fi
###
### i3blocks
###
if ask "Symlink i3blocks?" "${ASK}"; then
symlink_file "${MY_PATH}/i3blocks" "${HOME}/.config/i3blocks" "${MY_BACKUPDIR}"
fi
###
### neovim
###
if ask "Symlink neovim?" "${ASK}"; then
NVIM_BUNDLES="${HOME}/.local/share/nvim/bundles"
BIN_PHPCTAGS="${NVIM_BUNDLES}/repos/github.com/vim-php/tagbar-phpctags.vim/bin/phpctags"
TMP_SCRIPT="$( mktemp )"
# Link nvim configuration
symlink_file "${MY_PATH}/neovim" "${HOME}/.config/nvim" "${MY_BACKUPDIR}"
# Install dein (vim package manager)
curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > "${TMP_SCRIPT}"
sh "${TMP_SCRIPT}" "${NVIM_BUNDLES}"
rm -f ${TMP_SCRIPT}
# Install dein Plugins
nvim +'call dein#install()' +qall
# Symlink phpctags
if [ -f "${BIN_PHPCTAGS}" ]; then
ln -sf "${BIN_PHPCTAGS}" "${HOME}/bin/phpctags"
fi
fi
###
### profanity
###
if ask "Symlink profanity?" "${ASK}"; then
symlink_file "${MY_PATH}/profanity" "${HOME}/.config/profanity" "${MY_BACKUPDIR}"
fi
###
### qt
###
if ask "Symlink qt config?" "${ASK}"; then
symlink_file "${MY_PATH}/qt/Trolltech.conf" "${HOME}/.config/Trolltech.conf" "${MY_BACKUPDIR}"
fi
###
### readline
###
if ask "Symlink readline?" "${ASK}"; then
symlink_file "${MY_PATH}/readline/inputrc" "${HOME}/.inputrc" "${MY_BACKUPDIR}"
fi
###
### redshift
###
if ask "Symlink redshift?" "${ASK}"; then
symlink_file "${MY_PATH}/redshift/redshift.conf" "${HOME}/.config/redshift.conf" "${MY_BACKUPDIR}"
fi
###
### sublime
###
if ask "Symlink Sublime?" "${ASK}"; then
symlink_file "${MY_PATH}/sublime/Default (Linux).sublime-keymap" "${HOME}/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/sublime/Package Control.sublime-settings" "${HOME}/.config/sublime-text-3/Packages/User/Package Control.sublime-settings" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/sublime/Preferences.sublime-settings" "${HOME}/.config/sublime-text-3/Packages/User/Preferences.sublime-settings" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/sublime/SublimeCodeIntel.sublime-settings" "${HOME}/.config/sublime-text-3/Packages/User/SublimeCodeIntel.sublime-settings" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/sublime/Asphalt (SL).tmTheme" "${HOME}/.config/sublime-text-3/Packages/User/SublimeLinter/Asphalt (SL).tmTheme" "${MY_BACKUPDIR}"
fi
###
### sxiv
###
if ask "Symlink sxiv?" "${ASK}"; then
symlink_file "${MY_PATH}/sxiv/conf" "${HOME}/.config/sxiv" "${MY_BACKUPDIR}"
fi
###
### thunar
###
if ask "Symlink thunar?" "${ASK}"; then
symlink_file "${MY_PATH}/thunar/thunar.xml" "${HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/thunar/thunar-volman.xml" "${HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml-volman" "${MY_BACKUPDIR}"
fi
###
### tmux
###
if ask "Symlink tmux?" "${ASK}"; then
_TMUX_PLUGINS="${MY_PATH}/tmux/config/plugins"
symlink_file "${MY_PATH}/tmux/tmux.conf" "${HOME}/.tmux.conf" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/tmux/config" "${HOME}/.config/tmux" "${MY_BACKUPDIR}"
if [ ! -d "${_TMUX_PLUGINS}/tmux-copycat" ]; then
git clone https://github.com/tmux-plugins/tmux-copycat ${_TMUX_PLUGINS}/tmux-copycat
else
cd "${_TMUX_PLUGINS}/tmux-copycat" && \
git stash && \
git checkout master && \
git fetch --all --prune && \
git pull origin master
fi
if [ ! -d "${_TMUX_PLUGINS}/tmux-open" ]; then
git clone https://github.com/tmux-plugins/tmux-open ${_TMUX_PLUGINS}/tmux-open
else
cd "${_TMUX_PLUGINS}/tmux-open" && \
git stash && \
git checkout master && \
git fetch --all --prune && \
git pull origin master
fi
if [ ! -d "${_TMUX_PLUGINS}/tmux-urlview" ]; then
git clone https://github.com/tmux-plugins/tmux-urlview ${_TMUX_PLUGINS}/tmux-urlview
else
cd "${_TMUX_PLUGINS}/tmux-urlview" && \
git stash && \
git checkout master && \
git fetch --all --prune && \
git pull origin master
fi
fi
###
### X11
###
if ask "Symlink X11 configs?" "${ASK}"; then
symlink_file "${MY_PATH}/X11/xinitrc" "${HOME}/.xinitrc" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/X11/Xmodmap" "${HOME}/.Xmodmap" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/X11/Xresources" "${HOME}/.Xresources" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/X11/xsession" "${HOME}/.xsession" "${MY_BACKUPDIR}"
symlink_file "${MY_PATH}/X11/Xresources.d" "${HOME}/.config/Xresources.d" "${MY_BACKUPDIR}"
fi
###
### xdg
###
if ask "Symlink xdg?" "${ASK}"; then
symlink_file "${MY_PATH}/xdg/mimeapps.list" "${HOME}/.config/mimeapps.list" "${MY_BACKUPDIR}"
fi
###
### zathura
###
if ask "Symlink zathura?" "${ASK}"; then
symlink_file "${MY_PATH}/zathura" "${HOME}/.config/zathura" "${MY_BACKUPDIR}"
fi