-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·177 lines (163 loc) · 6.09 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·177 lines (163 loc) · 6.09 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/usr/bin/env bash
set -e
_BASE_DIR=$(pwd)
# Common Funcstions
echoHeader()
{
# Blue, underline
echo -e "\033[0;34;4m${1}\033[0m"
}
echoSection()
{
echo -e "\033[47;30m${1}\033[0m"
}
echoInfo()
{
# Green
echo -e "\033[0;32m${1}\033[0m"
}
echoError()
{
# Red
echo -e "\033[0;31m${1}\033[0m"
}
# Common Funcstions End
check()
{
echo "Check dot files installation"
echo "PWD is $_BASE_DIR"
# bash_aliases
[[ -h ~/.bash_aliases ]] || { echoError "No .bash_aliases found in ~/"; }
# .bashrc
[[ -h ~/.bashrc ]] || { echoError "No .bashrc found in ~/"; }
# .editorconfig
[[ -h ~/.editorconfig ]] || { echoError "No .editorconfig found in ~/"; }
# .inputrc
[[ -h ~/.inputrc ]] || { echoError "No .inputrc found in ~/"; }
# linux_setting.vim
[[ -h ~/linux_setting.vim ]] || { echoError "No .linux_setting.vim found in ~/"; }
# pacman.conf
[[ -h /etc/pacman.conf ]] || { echoError "No pacman.conf found in /etc"; }
# .tmux.conf color.tmux status
[[ -d ~/.byobu ]] || { echoError "You may not install byobu"; }
[[ -h ~/.byobu/.tmux.conf ]] || { echoError "No .tmux.conf found in ~/.byobu"; }
[[ -h ~/.byobu/color.tmux ]] || { echoError "No color.tmux found in ~/.byobu"; }
[[ -h ~/.byobu/status ]] || { echoError "No status found in ~/.byobu"; }
# .vimrc
[[ -h ~/.vimrc ]] || { echoError "No .vimrc found in ~/"; }
# .vrapperrc
[[ -h ~/.vrapperrc ]] || { echoError "No .vrapperrc found in ~/"; }
# .xprofile
[[ -h ~/.xprofile ]] || { echoError "No .xprofile found in ~/"; }
# .zshrc
[[ -h ~/.zshrc ]] || { echoError "No .zshrc found in ~/"; }
# .gitconfig
[[ -h ~/.gitconfig ]] || { echoError "No .gitconfig found in ~/"; }
# .gitignore_global
[[ -h ~/.gitignore_global ]] || { echoError "No .gitconfig found in ~/"; }
# .newsbeuter's config and url
[[ -d ~/.newsbeuter ]] || { echoError "You may not install newsbeuter"; }
[[ -h ~/.newsbeuter/config ]] || { echoError "No config found in ~/.newsbeuter"; }
[[ -h ~/.newsbeuter/urls ]] || { echoError "No urls found in ~/.newsbeuter"; }
# common-aliases.plugin.zsh
[[ -d ~/.oh-my-zsh ]] || { echoError "You may not install oh-my-zsh"; }
[[ -h ~/.oh-my-zsh/custom/plugins/common-aliases.plugin.zsh ]] || { echoError " No common-aliases.plugin.zsh found in ~/.oh-my-zsh/custom/plugins"; }
# rainbow
[[ -h ~/.rainbow/mvn3.cfg ]] || { echoError "No mvn3.cfg found in ~/.rainbow";}
# SSH Key on KDE
[[ -h ~/.kde4/Autostart/autostart.sh ]] || { echoError "No autostart.sh found in ~/.kde4/Autostart";}
[[ -h ~/.kde4/env/env-pre-autostart.sh ]] || { echoError "No env-pre-autostart.sh found in ~/.kde4/env";}
[[ -h ~/.kde4/shutdown/shutdown.sh ]] || { echoError "No shutdown.sh found in ~/.kde4/shutdown";}
# vim spell
[[ -h ~/.vim/spell/en.utf-8.add ]] || { echoError "No en.utf-8.add found in ~/.vim/spell"; }
# terminator config
[[ -h ~/.config/terminator/config ]] || { echoError "No config found in ~/.config/terminator"; }
}
doln()
{
sourceFile=$1
targetFile=$2
[[ -f $sourceFile ]] || { echoError "$sourceFile does not exist!"; exit 1; }
ln -sf $sourceFile $targetFile
echoInfo "${sourceFile} --> ${targetFile}"
}
install()
{
echoHeader "Install dot files"
# bash_aliases
doln ${_BASE_DIR}/.bash_aliases ~/.bash_aliases
# .bashrc, using archlinux
doln ${_BASE_DIR}/.bashrc_kde_arch ~/.bashrc
# .editorconfig
doln ${_BASE_DIR}/.editorconfig ~/.editorconfig
# .inputrc
doln ${_BASE_DIR}/.inputrc ~/.inputrc
# linux_setting.vim
doln ${_BASE_DIR}/linux_setting.vim ~/linux_setting.vim
# .vimrc
doln ${_BASE_DIR}/.vimrc ~/.vimrc
# .vrapperrc
doln ${_BASE_DIR}/.vrapperrc ~/.vrapperrc
# .xprofile
doln ${_BASE_DIR}/.xprofile ~/.xprofile
# .zshrc
doln ${_BASE_DIR}/.zshrc ~/.zshrc
# .gitconfig
doln ${_BASE_DIR}/GitFile/.gitconfig ~/.gitconfig
# .gitignore_global
doln ${_BASE_DIR}/GitFile/.gitignore_global ~/.gitignore_global
# vim spell
[[ -d ~/.vim/spell ]] || { mkdir -p ~/.vim/spell; }
doln ${_BASE_DIR}/vim/spell/en.utf-8.add ~/.vim/spell/en.utf-8.add
# .tmux.conf
if [[ -d ~/.byobu ]]; then
doln ${_BASE_DIR}/byobu/.tmux.conf ~/.byobu/.tmux.conf
doln ${_BASE_DIR}/byobu/color.tmux ~/.byobu/color.tmux
doln ${_BASE_DIR}/byobu/status ~/.byobu/status
else
echoError "You may not install byobu at first";
fi
# .newsbeuter's config and url
if [[ -d ~/.newsbeuter ]]; then
doln ${_BASE_DIR}/newsbeuter/config ~/.newsbeuter/config
doln ${_BASE_DIR}/newsbeuter/urls ~/.newsbeuter/urls
else
echoError "You may not install newsbeuter at first";
fi
# common-aliases.plugin.zsh
if [[ -d ~/.oh-my-zsh ]]; then
[[ -d ~/.oh-my-zsh/custom/plugins ]] || { mkdir -p ~/.oh-my-zsh/custom/plugins; }
doln ${_BASE_DIR}/oh-my-zsh/custom/plugins/common-aliases.plugin.zsh ~/.oh-my-zsh/custom/plugins/common-aliases.plugin.zsh
else
echoError "You may not install oh-my-zsh at first";
fi
# SSH Key on KDE
if [[ -d ~/.kde4 ]]; then
doln ${_BASE_DIR}/ssh/autostart.sh ~/.kde4/Autostart/autostart.sh
doln ${_BASE_DIR}/ssh/env-pre-autostart.sh ~/.kde4/env/env-pre-autostart.sh
doln ${_BASE_DIR}/ssh/shutdown.sh ~/.kde4/shutdown/shutdown.sh
else
echoError "You are not using KDE"
fi
# pacman.conf
[[ -h /etc/pacman.conf ]] || { echoError "No pacman.conf found in /etc. You'd better manually install it"; }
# terminator config
if [[ -d ~/.config/terminator ]]; then
doln ${_BASE_DIR}/terminator/config ~/.config/terminator/config
else
echoError "You may not install terminator at first"
fi
# rainbow
if [[ -d ~/.rainbow ]]; then
doln ${_BASE_DIR}/rainbow/mvn3.cfg ~/.rainbow/mvn3.cfg
else
echoError "You may not install rainbow at first"
fi
echoHeader "Install dot files finished"
}
## Main
case $1 in
'-c') check;;
'-i') install;;
*) echo "$(basename $0): unknown option '$@'"; exit 1;;
esac