Skip to content

Commit 5efd65c

Browse files
author
程煊
committed
update install.sh
1 parent 7aa09c5 commit 5efd65c

File tree

1 file changed

+95
-34
lines changed

1 file changed

+95
-34
lines changed

install.sh

Lines changed: 95 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,25 @@ function get_platform_type()
66
echo $(uname)
77
}
88

9-
# 获取linux平台类型
10-
function get_linux_platform_type()
9+
# 获取linux发行版名称
10+
function get_linux_distro()
1111
{
12-
if which zypper > /dev/null ; then
13-
echo "opensuse"
14-
elif which apt-get > /dev/null ; then
15-
echo "ubuntu" # debian,ubuntu,deepin,linuxmint
16-
elif which yum > /dev/null ; then
17-
echo "centos" # centos,redhat
18-
elif which pacman > /dev/null; then
19-
echo "archlinux"
12+
if grep -Eq "Ubuntu" /etc/*-release; then
13+
echo "Ubuntu"
14+
elif grep -Eq "Deepin" /etc/*-release; then
15+
echo "Deepin"
16+
elif grep -Eq "LinuxMint" /etc/*-release; then
17+
echo "LinuxMint"
18+
elif grep -Eq "Debian" /etc/*-release; then
19+
echo "Debian"
20+
elif grep -Eq "CentOS" /etc/*-release; then
21+
echo "CentOS"
22+
elif grep -Eq "openSUSE" /etc/*-release; then
23+
echo "openSUSE"
24+
elif grep -Eq "ArchLinux" /etc/*-release; then
25+
echo "ArchLinux"
2026
else
21-
echo "invaild"
27+
echo "Unknow"
2228
fi
2329
}
2430

@@ -67,6 +73,40 @@ function compile_vim_on_ubuntu()
6773
cd -
6874
}
6975

76+
# 在debian上源代码安装vim
77+
function compile_vim_on_debian()
78+
{
79+
sudo apt-get remove -y vim vim-runtime gvim
80+
sudo apt-get remove -y vim-tiny vim-common vim-gui-common vim-nox
81+
sudo rm -rf /usr/bin/vim*
82+
sudo rm -rf /usr/local/bin/vim*
83+
sudo rm -rf /usr/share/vim/vim*
84+
sudo rm -rf /usr/local/share/vim/vim*
85+
rm -rf ~/vim.tar.bz2
86+
rm -rf ~/vim81
87+
88+
sudo apt-get install -y libncurses5-dev libgtk2.0-dev libatk1.0-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev python3-dev ruby-dev lua5.1 lua5.1-dev
89+
90+
sudo ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/libtinfo.so.5
91+
92+
curl https://ftp.nluug.nl/pub/vim/unix/vim-8.1.tar.bz2 -o ~/vim.tar.bz2
93+
tar -xvf ~/vim.tar.bz2 -C ~
94+
cd ~/vim81
95+
./configure --with-features=huge \
96+
--enable-multibyte \
97+
--enable-rubyinterp \
98+
--enable-pythoninterp \
99+
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
100+
--enable-perlinterp \
101+
--enable-luainterp \
102+
--enable-gui=gtk2 \
103+
--enable-cscope \
104+
--prefix=/usr
105+
make
106+
sudo make install
107+
cd -
108+
}
109+
70110
# 在centos上源代码安装vim
71111
function compile_vim_on_centos()
72112
{
@@ -110,14 +150,7 @@ function install_prepare_software_on_mac()
110150
brew install vim gcc cmake ctags-exuberant curl ack
111151
}
112152

113-
# 安装centos发行版必要软件
114-
function install_prepare_software_on_centos()
115-
{
116-
sudo yum install -y ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel curl fontconfig ack bzip2 git
117-
compile_vim_on_centos
118-
}
119-
120-
# 安装ubuntu发行版必要软件
153+
# 安装ubuntu必要软件
121154
function install_prepare_software_on_ubuntu()
122155
{
123156
sudo apt-get update
@@ -133,13 +166,28 @@ function install_prepare_software_on_ubuntu()
133166
compile_vim_on_ubuntu
134167
}
135168

136-
# 安装archlinux发行版必要软件
169+
# 安装debian必要软件
170+
function install_prepare_software_on_debian()
171+
{
172+
sudo apt-get update
173+
sudo apt-get install -y cmake ctags build-essential python python-dev python3-dev fontconfig curl libfile-next-perl ack-grep git
174+
compile_vim_on_debian
175+
}
176+
177+
# 安装centos必要软件
178+
function install_prepare_software_on_centos()
179+
{
180+
sudo yum install -y ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel curl fontconfig ack bzip2 git
181+
compile_vim_on_centos
182+
}
183+
184+
# 安装archlinux必要软件
137185
function install_prepare_software_on_archlinux()
138186
{
139187
sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2 curl ack git
140188
}
141189

142-
# 安装opensuse发行版必要软件
190+
# 安装opensuse必要软件
143191
function install_prepare_software_on_opensuse()
144192
{
145193
sudo zypper install -y vim ctags gcc gcc-c++ cmake python-devel python3-devel curl ack fontconfig git ncurses5-devel
@@ -274,50 +322,63 @@ function begin_install_vimplus()
274322
print_logo
275323
}
276324

277-
# 在ubuntu发行版安装vimplus
325+
# 在ubuntu上安装vimplus
278326
function install_vimplus_on_ubuntu()
279327
{
280328
install_prepare_software_on_ubuntu
281329
begin_install_vimplus
282330
}
283331

284-
# 在centos发行版安装vimplus
332+
# 在debian上安装vimplus
333+
function install_vimplus_on_debian()
334+
{
335+
install_prepare_software_on_debian
336+
begin_install_vimplus
337+
}
338+
339+
# 在centos上安装vimplus
285340
function install_vimplus_on_centos()
286341
{
287342
install_prepare_software_on_centos
288343
begin_install_vimplus
289344
}
290345

291-
# 在archlinux发行版安装vimplus
346+
# 在archlinux上安装vimplus
292347
function install_vimplus_on_archlinux()
293348
{
294349
install_prepare_software_on_archlinux
295350
begin_install_vimplus
296351
}
297352

298-
# 在opensuse发行版安装vimplus
353+
# 在opensuse上安装vimplus
299354
function install_vimplus_on_opensuse()
300355
{
301356
install_prepare_software_on_opensuse
302357
begin_install_vimplus
303358
}
304359

305-
# 在linux平台安装vimplus
360+
# 在linux平上台安装vimplus
306361
function install_vimplus_on_linux()
307362
{
308-
type=`get_linux_platform_type`
309-
echo "Linux platform type: "${type}
363+
distro=`get_linux_distro`
364+
echo "Linux distro: "${distro}
310365

311-
if [ ${type} == "ubuntu" ]; then
366+
if [ ${distro} == "Ubuntu" ]; then
367+
install_vimplus_on_ubuntu
368+
elif [ ${distro} == "Deepin" ]; then
312369
install_vimplus_on_ubuntu
313-
elif [ ${type} == "centos" ]; then
370+
elif [ ${distro} == "LinuxMint" ]; then
371+
install_vimplus_on_ubuntu
372+
elif [ ${distro} == "Debian" ]; then
373+
install_vimplus_on_debian
374+
elif [ ${distro} == "CentOS" ]; then
314375
install_vimplus_on_centos
315-
elif [ ${type} == "archlinux" ]; then
316-
install_vimplus_on_archlinux
317-
elif [ ${type} == "opensuse" ]; then
376+
elif [ ${distro} == "openSUSE" ]; then
318377
install_vimplus_on_opensuse
378+
elif [ ${distro} == "ArchLinux" ]; then
379+
install_vimplus_on_archlinux
319380
else
320-
echo "Not support this linux platform type: "${type}
381+
echo "Not support this linux platform distro: "${distro}
321382
fi
322383
}
323384

0 commit comments

Comments
 (0)