-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·68 lines (64 loc) · 2.02 KB
/
install.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
#!/bin/bash
set -e
Get_Dist_Name()
{
if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
DISTRO='CentOS'
PM='yum'
elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
DISTRO='RHEL'
PM='yum'
elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
DISTRO='Aliyun'
PM='yum'
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
DISTRO='Fedora'
PM='yum'
elif grep -Eqi "Amazon Linux AMI" /etc/issue || grep -Eq "Amazon Linux AMI" /etc/*-release; then
DISTRO='Amazon'
PM='yum'
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
DISTRO='Debian'
PM='apt'
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
DISTRO='Ubuntu'
PM='apt'
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
DISTRO='Raspbian'
PM='apt'
elif grep -Eqi "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
DISTRO='Deepin'
PM='apt'
elif grep -Eqi "Mint" /etc/issue || grep -Eq "Mint" /etc/*-release; then
DISTRO='Mint'
PM='apt'
else
DISTRO='unknow'
fi
}
cd $(dirname "$0")
# 脚本需要用root运行
[[ $EUID -ne 0 ]] && echo "Error: This script must be run as root!" && exit 1
# 提示会覆盖文件
confirm=""
read -p "will overwrite ~/.vimrc file,confirm?(y/other): " confirm
if [ $confirm != 'y' ]; then
exit 1
fi
# 判断系统 安装必须的依赖
Get_Dist_Name
if [ $PM = 'apt' ]; then
$PM install -y vim vim-gtk3 exuberant-ctags curl git
else
$PM install -y vim vim-gtk3 ctags curl git
fi
# 把vimrc放到~/.vimrc
cp vimrc ~/.vimrc
# 安装 插件
mkdir -p ~/.vim
mkdir -p ~/.vim/bundle
cd ~/.vim/bundle
rm -rf Vundle.vim
git clone https://github.com/VundleVim/Vundle.vim.git
vim +PluginInstall +qall
echo Successful installation!