-
Notifications
You must be signed in to change notification settings - Fork 74
/
uml.sh
66 lines (54 loc) · 1.82 KB
/
uml.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
#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================================#
# System Required: CentOS 6,7, Debian, Ubuntu #
# Description: One click Install UML for bbr+ssr #
# Author: 91yun <https://twitter.com/91yun> #
# Thanks: @allient #
# Intro: https://www.91yun.org/archives/2079 #
#=================================================================#
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "Error:This script must be run as root!" 1>&2
exit 1
fi
if [ -f /etc/redhat-release ]; then
release="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
release="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
release="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
release="centos"
elif cat /proc/version | grep -Eqi "debian"; then
release="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
release="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
release="centos"
else
echo "Not support OS, Please reinstall OS and retry!"
exit 1
fi
function getversion(){
if [[ -s /etc/redhat-release ]];then
grep -oE "[0-9.]+" /etc/redhat-release
else
grep -oE "[0-9.]+" /etc/issue
fi
}
ver=""
centosversion() {
if [ "${release}" == "centos" ]; then
local version="$(getversion)"
local main_ver=${version%%.*}
ver=$main_ver
else
return 1
fi
}
centosversion
if [[ "$release" = "centos" && "$ver" = "6" ]]; then
wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/uml/master/bbr/centos6.sh && bash centos6.sh
fi