-
Notifications
You must be signed in to change notification settings - Fork 2
/
start.sh
executable file
·104 lines (86 loc) · 2.09 KB
/
start.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
#/bin/bash
dirPath=$(
cd $(dirname $0)
pwd
)
LOG_FILE=/tmp/aierui_config_start.log
function log() {
echo ">> $(date) $*" >>${LOG_FILE}
}
function elog() {
echo "$*"
echo ">> $(date) $*" >>${LOG_FILE}
}
function run() {
log "@$*"
# shellcheck disable=SC2068
$@ >>${LOG_FILE} 2>&1
}
function installDependentOnLinux() {
log "start install that dependent soft ware"
run yum install -y sysstat \
dstat \
iftop \
iotop \
telnet \
net-tools \
jq \
vim \
gcc \
gcc-c++ \
make \
ctags \
tree \
zsh
log "install finished that dependent soft ware"
}
function installDependentOnMac() {
# brew install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap mongodb/brew
brew install wget python python3 tree node cmake vim jq
# nodejs install
npm install -g hexo-cli typescript
}
function installSoftWare() {
if [[ "$OSTYPE" == "darwin"* ]]; then
installDependentOnMac
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
installDependentOnLinux
elif [[ "$OSTYPE" == "freebsd"* ]]; then
installDependentOnLinux
else
exit
fi
}
function installExtend() {
# install zsh
# install oh-my-zsh (before install zsh)
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
# install zsh theme
cd ~/.oh-my-zsh/custom/plugins/ && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
cd ~/.oh-my-zsh/custom/plugins/ && git clone https://github.com/zsh-users/zsh-autosuggestions.git
cd ${dirPath}
}
function linkFile() {
# zsh link
ln -sf ${dirPath}/.zshrc ~/.zshrc
## Links config file
# git config
ln -sf ${dirPath}/git/.gitconfig ~/.gitconfig
ln -sf ${dirPath}/git/.gitignore_global ~/.gitignore_global
## vim https://github.com/BroQiang/vim-go-ide
ln -sf ${dirPath}/.vimrc ~/.vimrc
}
function clean() {
run rm -rf /root/.oh-my-zsh
}
function start() {
log "start configuration environmental"
clean
installSoftWare
installExtend
linkFile
log "end of configuration environmental"
}
start