-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-settings
executable file
·218 lines (178 loc) · 5.9 KB
/
install-settings
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
#!/usr/bin/env bash
settings_path=$(dirname $0)
diff_file=/tmp/install.diff
diff_cp() {
if [ -z "$1" -o -z "$2" ]; then
return 0
fi
if [ ! -e $2 ]; then
$3 cp $1 $2
fi
diff -u $2 $1 > $diff_file
local diff_return=$?
if [ $diff_return -eq 0 ]; then
return 1
fi
while [ 1 ]; do
echo cp: overwrite "'$2' [Y/n/d(diff)]? "
read choice
if [ "$choice" = "Y" -o "$choice" = "y" ]; then
$3 cp $1 $2
return 2
elif [ "$choice" = "N" -o "$choice" = "n" ]; then
return 3
elif [ "$choice" = "d" ]; then
less -X $diff_file
fi
done
}
fge() {
awk -v n1=$1 -v n2=$2 'BEGIN{ if (n1 >= n2) exit 0; exit 1 }'
}
echo_begin() {
echo "--- $1 settings ---"
}
echo_end() {
echo "$1 settings... OK"
}
echo_begin emacs
if [ ! -d ~/.emacs.d/snippets ]; then
ln -s $PWD/$settings_path/emacs/snippets ~/.emacs.d/snippets
fi
[ ! -d ~/.emacs.d ] && mkdir ~/.emacs.d
ln -sf $PWD/$settings_path/emacs/jglee-theme.el ~/.emacs.d/
diff_cp $settings_path/emacs/.emacs ~/.emacs
diff_cp $settings_path/emacs/.emacs-custom.el ~/.emacs-custom.el
diff_cp $settings_path/.dir-locals.el ~/.dir-locals.el
fc-list | grep NanumGothic_AndaleMono > /dev/null
if [ $? -eq 0 ]; then
diff_cp $settings_path/emacs/linux/.Xresources ~/.Xresources
fi
# emacs --batch -f batch-byte-compile ~/.emacs 2> ~/.emacs.elc.log
echo_end emacs
echo_begin vim
diff_cp $settings_path/vim/.vimrc ~/.vimrc
echo_end vim
echo_begin xmodmap
diff_cp $settings_path/xmodmap/.Xmodmap ~/.Xmodmap
echo_end xmodmap
# comment out to resolve the deprecated warning on Debian 7.0 testing
# echo_begin font
# diff_cp $settings_path/fonts/.fonts.conf ~/.config/fontconfig/fonts.conf
# diff_cp $settings_path/fonts/.fonts.conf ~/.fonts.conf
# echo_end font
echo_begin git
git_user_name="`git config --global --get user.name`"
git_user_email="`git config --global --get user.email`"
diff_cp $settings_path/git/.gitconfig ~/.gitconfig
git_version=`git --version | cut -d ' ' -f 3`
if fge $git_version 1.7.11; then
git config --global push.default simple
else
git config --global push.default current
fi
if [ "$git_user_name" = "" ]; then
echo -n "user.name: "
read git_user_name
fi
if [ "$git_user_email" = "" ]; then
echo -n "user.email: "
read git_user_email
fi
git config --global user.name "$git_user_name"
git config --global user.email "$git_user_email"
echo_end git
echo_begin gdb
diff_cp $settings_path/gdb/.gdbinit ~/.gdbinit
echo_end gdb
echo_begin lldb
diff_cp $settings_path/lldb/.lldbinit ~/.lldbinit
echo_end lldb
if [ -d ~/.moc ]; then
echo_begin moc
diff_cp $settings_path/moc/config ~/.moc/config
echo_end moc
fi
if [ -d ~/.mplayer ]; then
echo_begin mplayer
diff_cp $settings_path/mplayer/config ~/.mplayer/config
echo_end mplayer
fi
if [ -d ~/.config/terminator ]; then
echo -ne "terminator setting...\r"
diff_cp $settings_path/terminator/config ~/.config/terminator/config
echo terminator setting... OK
fi
if [ -d ~/.fluxbox/ ]; then
echo_begin fluxbox
diff_cp $settings_path/fluxbox/init ~/.fluxbox/init
diff_cp $settings_path/fluxbox/keys ~/.fluxbox/keys
diff_cp $settings_path/fluxbox/overlay ~/.fluxbox/overlay
diff_cp $settings_path/fluxbox/startup ~/.fluxbox/startup
echo_end fluxbox
fi
[ ! -d ~/.config/dunst ] && mkdir -p ~/.config/dunst
if [ -d ~/.config/dunst ]; then
echo_begin dunst
diff_cp $settings_path/dunst/dunstrc ~/.config/dunst/dunstrc
echo_end dunst
fi
if [ -d ~/.config/openbox ]; then
echo_begin openbox
diff_cp $settings_path/openbox/environment ~/.config/openbox/environment
diff_cp $settings_path/openbox/autostart.sh ~/.config/openbox/autostart.sh
diff_cp $settings_path/openbox/rc.xml ~/.config/openbox/rc.xml
diff_cp $settings_path/openbox/menu.xml ~/.config/openbox/menu.xml
echo_end oepnbox
echo_begin blueskyonyx
mkdir -p ~/.themes
if [ ! -L ~/.themes/blueskyonyx ]; then
ln -s $(realpath $settings_path)/themes/blueskyonyx ~/.themes/blueskyonyx
fi
echo_end blueskyonyx
fi
if [ -d ~/.config/i3 ]; then
echo_begin i3
diff_cp $settings_path/i3/config ~/.config/i3/config
diff_cp $settings_path/i3/i3status.conf ~/.config/i3/i3status.conf
echo_end i3
fi
if [ "`which xterm 2> /dev/null`" != "" ]; then
echo_begin xterm
diff_cp $settings_path/xterm/.Xdefaults ~/.Xdefaults
echo_end xterm
fi
if [ "`which stumpwm 2> /dev/null`" != "" ]; then
echo_begin StumpWM
diff_cp $settings_path/stumpwm/.stumpwmrc ~/.stumpwmrc
diff_cp $settings_path/stumpwm/stumpwm.desktop /usr/share/xsessions/stumpwm.desktop sudo
echo_end StumpWM
fi
if [ "`which tmux 2> /dev/null`" != "" ]; then
echo_begin tmux
diff_cp $settings_path/tmux/.tmux.conf ~/.tmux.conf
echo_end tmux
fi
if [ "`which conky 2> /dev/null`" != "" ]; then
echo_begin conky
diff_cp $settings_path/conky/.conkyrc ~/.conkyrc
echo_end conky
fi
if [ "`which conkeror 2> /dev/null`" != "" ]; then
echo_begin conkeror
diff_cp $settings_path/conkeror/.conkerorrc ~/.conkerorrc
# make conkeror bookmarks synchronize with firefox bookmarks
firefox_config_path=~/.mozilla/firefox
conkeror_config_path=~/.conkeror.mozdev.org/conkeror
if [ -d $firefox_config_path -a -d $conkeror_config_path ]; then
firefox_bookmarks=$firefox_config_path/$(cat $firefox_config_path/profiles.ini | grep Path | awk 'BEGIN { FS = "=" } { print $2 }')
conkeror_bookmarks=$conkeror_config_path/$(cat $conkeror_config_path/profiles.ini | grep Path | awk 'BEGIN { FS = "=" } { print $2 }')
cp $firefox_bookmarks/places.sqlite $conkeror_bookmarks/places.sqlite
fi
echo_end conkeror
fi
if [ -f /Applications/Slate.app/Contents/MacOS/Slate ]; then
echo_begin Slate
diff_cp $settings_path/slate/.slate ~/.slate
echo_end Slate
fi