-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_script.sh
588 lines (519 loc) · 13.3 KB
/
install_script.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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
#!/bin/bash
source ./init_env.sh
source `echo $env_script`
source `echo $source_script`
export unexpected_quit=0
trap 'onCtrlC' INT
function onCtrlC () {
echo 'Ctrl+C is captured'
export unexpected_quit=1
}
function auto_get_download_name() {
echo ${1##*/}
}
function download_wrapper() {
download_fin=1
retry=10
wait_costs_secs=600
echo 1 > /dev/shm/foo
filename=$(auto_get_download_name $1)
function real_download() {
echo "start download $1"
wget $1
ret=$?
echo "download return val: $ret"
echo $ret > /dev/shm/foo
}
for i in {1..10}
do
real_download $1
if [ $? -eq 0 ]
then
return 0
fi
done
}
function is_installed() {
if [ ! -d "$1" ]
then
return 1
fi
if [ "`ls -A $1`" = "" ]
then
return 1
else
echo "$1 has been installed ."
return 0
fi
}
function check_ret() {
if [ $3 -ne 0 ]
then
echo "------------------------"
echo "$1 $2 failed, ret:$3"
echo "------------------------"
exit
fi
}
home=$HOME
software="$home/software"
local="$home/local"
function init() {
#rm /usr/bin/python
#ln -s /usr/bin/python2.6 /usr/bin/python
cd
mkdir software
mkdir local
yum install xz
yum install perl
yum install perl-Thread-Queue
}
function install_openssl() {
name="openssl-1.0.2"
openssl_local="$local/$name"
is_installed $openssl_local
if [ $? -eq 0 ]
then
return 0
fi
cd && cd software
echo "================================ rm "
rm openssl-1.0.2.tar.gz
get_source $name
download_wrapper $source_addr
check_ret "download" $name $?
tar xzf openssl-1.0.2.tar.gz
cd $name
mkdir $openssl_local
./config --prefix=$openssl_local -fPIC
check_ret "config" $name $?
make -j 32
make -j 32
# test error .
#check_ret "make" $name $?
make depend
check_ret "depend" $name $?
make install
check_ret "install" $name $?
bin="$openssl_local/bin"
lib="$openssl_local/lib64:$openssl_local/lib"
export PATH="$bin:$PATH"
export LD_LIBRARY_PATH="$lib:$LD_LIBRARY_PATH"
}
#------ install python
function install_python() {
name="Python-3.8.3"
python_local="$local/$name"
is_installed $python_local
if [ $? -eq 0 ]
then
return 0
fi
export PKG_CONFIG_PATH=$local/openssl-1.0.2/lib/pkgconfig/:$PKG_CONFIG_PATH
yum -y install gcc gcc-c++ zlib zlib-devel libffi-devel
yum -y install gcc kernel-devel kenel-headers make bzip2
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
cd && cd software
rm Python-3.8.3.tgz
get_source $name
download_wrapper $source_addr
check_ret "download" $name $?
tar xzf Python-3.8.3.tgz
cd Python-3.8.3
mkdir $python_local
#./configure --prefix=$python_local --enable-shared --enable-optimizations
./configure --prefix=$python_local --enable-shared
check_ret "config" $name $?
make -j 32
check_ret "make" $name $?
make install
check_ret "install" $name $?
bin="$python_local/bin"
lib="$python_local/lib64:$python_local/lib"
export PATH="$bin:$PATH"
export LD_LIBRARY_PATH="$lib:$LD_LIBRARY_PATH"
ln -s $bin/python3 $bin/python
}
# -------- install vim
function install_vim() {
name="vim-8.2"
vim_local="$local/$name"
is_install $vim_local
if [ $? -eq 0 ]
then
return 0
fi
name="ncurses"
yum install -y ncurses-devel.x86_64
yum install -y bzip2
check_ret "download" $name $?
name="vim-8.2"
cd && cd software
rm vim-8.2.tar.bz2
get_source $name
download_wrapper $source_addr
check_ret "download" $name $?
tar xf vim-8.2.tar.bz2
cd vim82
mkdir $vim_local
echo $vim_local
./configure --prefix=$vim_local --enable-python3interp=dynamic
make -j 32 && make install
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
echo "set encoding=utf-8" > $HOME/.vimrc
echo "set rtp+=~/.vim/bundle/Vundle.vim" >> $HOME/.vimrc
echo "call vundle#begin()" >> $HOME/.vimrc
echo "Plugin 'VundleVim/Vundle.vim'" >> $HOME/.vimrc
echo "call vundle#end()" >> $HOME/.vimrc
vim +BundleInstall +qall
}
# -------- install ycm
function install_ycm() {
name='ycm_config'
git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe
cd ~/.vim/bundle/YouCompleteMe
git submodule update --init --recursive
echo "set encoding=utf-8" > $HOME/.vimrc
echo "set rtp+=~/.vim/bundle/Vundle.vim" >> $HOME/.vimrc
echo "call vundle#begin()" >> $HOME/.vimrc
echo "Plugin 'VundleVim/Vundle.vim'" >> $HOME/.vimrc
echo "Plugin 'Valloric/YouCompleteMe'" >> $HOME/.vimrc
echo "call vundle#end()" >> $HOME/.vimrc
echo "vim +BundleInstall +qall" | bash
cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clang-completer
cd
get_source $name
download_wrapper $source_addr
mv ycm_extra_conf.py .ycm_extra_conf.py
}
# -------- install ycm
function install_cached_ycm() {
name='ycm_config'
wget https://s3plus.sankuai.com/v1/mss_f98ae29a284a4de8952b082c29b58dfb/zhaozheng09/custom/YouCompleteMe.tar.gz
tar xzf YouCompleteMe.tar.gz
mv YouCompleteMe ~/.vim/bundle/YouCompleteMe
cd ~/.vim/bundle/YouCompleteMe
mv $HOME/.vimrc $HOME/.vimrc_bak
echo "set encoding=utf-8" > $HOME/.vimrc
echo "set rtp+=~/.vim/bundle/Vundle.vim" >> $HOME/.vimrc
echo "call vundle#begin()" >> $HOME/.vimrc
echo "Plugin 'VundleVim/Vundle.vim'" >> $HOME/.vimrc
echo "Plugin 'Valloric/YouCompleteMe'" >> $HOME/.vimrc
echo "call vundle#end()" >> $HOME/.vimrc
echo "vim +BundleInstall +qall" | bash
cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clang-completer
mv $HOME/.vimrc_bak $HOME/.vimrc
cd
get_source $name
download_wrapper $source_addr
mv ycm_extra_conf.py .ycm_extra_conf.py
}
#----------- install color
function install_vimrc() {
name='vimrc'
cd
get_source $name
download_wrapper $source_addr
rm ~/.vimrc
mv vimrc ~/.vimrc
vim +BundleInstall +qall
}
#--------- install a.vim
function install_a_vim() {
name='a.vim'
cd && mkdir ~/.vim/plugin
rm $name
get_source $name
download_wrapper $source_addr
mv a.vim ~/.vim/plugin/
}
function install_pcre() {
name='pcre-8.42'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm pcre-8.42.tar.bz2
get_source $name
download_wrapper $source_addr
tar xjf pcre-8.42.tar.bz2
cd pcre-8.42
./configure --prefix=$local/$name
make && make install
}
function install_pkg() {
name="pkg-config-0.29.2"
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm pkg-config-0.29.2.tar.gz
get_source $name
download_wrapper $source_addr
tar xf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
./configure --prefix=$local/$name --with-internal-glib=$local/glibc
make && make install
}
function install_lzma() {
name="lzma"
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
git clone https://github.com/kobolabs/liblzma.git
cd liblzma
sh autogen.sh
./configure --prefix=$local/$name
make -j 32 && make install
yum install -y xz-devel
}
function install_ag() {
name="ag"
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
install_m4
install_autoconf
install_automake
install_pcre
install_lzma
cd && cd software
export PKG_CONFIG_PATH=$local/$pcre/lib/pkgconfig/:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=$local/$lzma/lib/pkgconfig/:$PKG_CONFIG_PATH
rm -rf the_silver_searcher
git clone https://github.com/ggreer/the_silver_searcher.git
cd the_silver_searcher
#sed -e 15a\\"AC_SEARCH_OPTS=\"-I $local/pkg/share/aclocal\"" autogen.sh > test.txt
#cp -rf test.txt autogen.sh
sh autogen.sh
cp /usr/share/aclocal/pkg.m4 m4/
autoreconf -i -f
aclocal -I m4
autoconf
name="ag"
./configure --prefix=$local/$name
make && make install
}
function install_m4() {
name='m4-1.4.9'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm m4-1.4.9.tar.gz
get_source $name
download_wrapper $source_addr
check_ret "download" "m4" $?
tar xf m4-1.4.9.tar.gz
cd ~/software/m4-1.4.9
./configure --prefix=$local/$name
make && make install
export PATH=$local/m4:$PATH
}
function install_autoconf() {
name='autoconf-2.69'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm autoconf-2.69.tar.gz
get_source $name
download_wrapper $source_addr
check_ret "download" "autoconf" $?
tar xf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=$local/$name
make && make install
export PATH=$local/autoconf:$PATH
}
function install_automake() {
name='automake-1.16.2'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm automake-1.16.2.tar.gz
get_source $name
download_wrapper $source_addr
check_ret "download" "automke" $?
tar xf automake-1.16.2.tar.gz
cd automake-1.16.2
./configure --prefix=$local/$name
sed -i 's/$(update_mans) automake-$(APIVERSION)/$(update_mans) automake-$(APIVERSION) --no-discard-stderr/g' Makefile
make && make install
export PATH=$local/automake:$PATH
}
function install_gcc74() {
name="gcc74"
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm gcc-7.4.0.tar.xz
rm gcc-7.4.0.tar
rm gcc-7.4.0
get_source $name
download_wrapper $source_addr
xz -d gcc-7.4.0.tar.xz
tar xf gcc-7.4.0.tar
rm gmp-6.1.0.tar.bz2
get_source 'gmp-6.1.0'
download_wrapper $source_addr
tar xjf gmp-6.1.0.tar.bz2
mv gmp-6.1.0 gcc-7.4.0/gmp
rm isl-0.16.1.tar.bz2
get_source 'isl-0.16.1'
download_wrapper $source_addr
tar xjf isl-0.16.1.tar.bz2
mv isl-0.16.1 gcc-7.4.0/isl
rm mpc-1.0.3.tar.gz
get_source 'mpc-1.0.3'
download_wrapper $source_addr
tar xzf mpc-1.0.3.tar.gz
mv mpc-1.0.3 gcc-7.4.0/mpc
rm mpfr-3.1.4.tar.bz2
get_source 'mpfr-3.1.4'
download_wrapper $source_addr
tar xjf mpfr-3.1.4.tar.bz2
mv mpfr-3.1.4 gcc-7.4.0/mpfr
cd gcc-7.4.0
mkdir build
cd build
../configure --prefix=$local/$name -disable-multilib
make -j 48 && make install
}
function install_gcc102() {
name="gcc-10.2.0"
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm gcc-10.2.0.tar.xz
rm gcc-10.2.0.tar
rm gcc-10.2.0
get_source $name
download_wrapper $source_addr
xz -d gcc-10.2.0.tar.xz
tar xf gcc-10.2.0.tar
rm gmp-6.1.0.tar.bz2
get_source 'gmp-6.1.0'
download_wrapper $source_addr
tar xjf gmp-6.1.0.tar.bz2
mv gmp-6.1.0 gcc-10.2.0/gmp
rm mpc-1.0.3.tar.gz
get_source 'mpc-1.0.3'
download_wrapper $source_addr
tar xzf mpc-1.0.3.tar.gz
mv mpc-1.0.3 gcc-10.2.0/mpc
rm mpfr-3.1.4.tar.bz2
get_source 'mpfr-3.1.4'
download_wrapper $source_addr
tar xjf mpfr-3.1.4.tar.bz2
mv mpfr-3.1.4 gcc-10.2.0/mpfr
cd gcc-10.2.0
mkdir build
cd build
../configure --prefix=$local/$name -disable-multilib
make -j 48 && make install
}
function install_glibc() {
name='glibc-2.19'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm glibc-2.19.tar.bz2
get_source $name
download_wrapper $source_addr
tar xjf glibc-2.19.tar.bz2
cd glibc-2.19
mkdir build
cd build
../configure --prefix=$local/$name
make -j 48
make install
}
function install_make() {
name='make-4.3'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm make-4.3.tar.gz
get_source $name
download_wrapper $source_addr
tar xzf make-4.3.tar.gz
cd make-4.3
./configure --prefix=$local/$name
make -j 32 && make install
}
function install_bison() {
name='bison-3.6'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm bison-3.6.tar.xz
get_source $name
download_wrapper $source_addr
xz -d bison-3.6.tar.xz
tar xf bison-3.6.tar
cd bison-3.6
./configure --prefix=$local/$name
make -j 32 && make install
}
function install_libtool() {
name='libtool-2.4.6'
is_installed "$local/$name"
if [ $? -eq 0 ]
then
return
fi
cd && cd software
rm libtool-2.4.6.tar.gz
get_source $name
download_wrapper $source_addr
tar xf libtool-2.4.6.tar.gz
cd libtool-2.4.6
sh autogen.sh
./configure --prefix=$local/$name
make && make install
}
if [ "$1" == "init" ]
then
init
install_openssl
install_python
install_vim
install_a_vim
install_vimrc
install_ag
fi
install_cached_ycm