-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarp.sh
134 lines (117 loc) · 4.61 KB
/
warp.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
#!/bin/bash
red='\033[1;91m' # Red
green='\033[1;92m' # Green
yellow='\033[1;93m' # Yellow
White='\033[1;97m' # White
blue='\033[1;94m' # blue
nc='\033[0m'
header(){
clear
echo ""
echo -e "${red}===============================================${nc}"
echo -e "${yellow} _ __ _____ _ __ ${nc}"
echo -e "${yellow}| | / /___ __________ / ___/__________(_)___ / /_${nc}"
echo -e "${yellow}| | /| / / __ / ___/ __ \ \__ \/ ___/ ___/ / __ \/ __/${nc}"
echo -e "${yellow}| |/ |/ / /_/ / / / /_/ / ___/ / /__/ / / / /_/ / /_ ${nc}"
echo -e "${yellow}|__/|__/\__,_/_/ / .___/ /____/\___/_/ /_/ .___/\__/ ${nc}"
echo -e "${yellow} /_/ /_/ ${nc}"
echo ""
echo -e "${green}Github: https://github.com/sh-vp/warp${nc}"
echo ""
echo -e "${red}===============================================${nc}"
echo ""
}
# check root
[[ $EUID -ne 0 ]] && echo -e "${red}Fatal error: ${nc} Please run this script with root privilege \n " && exit 1
# Check OS and set release variable
if [[ -f /etc/os-release ]]; then
source /etc/os-release
release=$ID
elif [[ -f /usr/lib/os-release ]]; then
source /usr/lib/os-release
release=$ID
else
header
echo "Failed to check the system OS, please contact the author!" >&2
exit 1
fi
echo "The OS release is: $release"
os_version=""
os_version=$(grep "^VERSION_ID" /etc/os-release | cut -d '=' -f2 | tr -d '"' | tr -d '.')
# Check OS and set release variable
if [[ "${release}" == "centos" ]]; then
if [[ ${os_version} -lt 8 ]]; then
header
echo -e "${red} Please use CentOS 8 or higher ${nc}\n" && exit 1
fi
elif [[ "${release}" == "ubuntu" ]]; then
if [[ ${os_version} -lt 2004 ]]; then
header
echo -e "${red} Please use Ubuntu 20 or higher version!${nc}\n" && exit 1
fi
elif [[ "${release}" == "debian" ]]; then
if [[ ${os_version} -lt 10 ]]; then
header
echo -e "${red} Please use Debian 10 or higher ${nc}\n" && exit 1
fi
elif [[ "${release}" == "almalinux" ]]; then
if [[ ${os_version} -lt 80 ]]; then
header
echo -e "${red} Please use AlmaLinux 8.0 or higher ${nc}\n" && exit 1
fi
elif [[ "${release}" == "rocky" ]]; then
if [[ ${os_version} -lt 8 ]]; then
header
echo -e "${red} Please use Rocky Linux 8 or higher ${nc}\n" && exit 1
fi
else
header
echo "Your System OS: ${release}"
echo -e "${red}Your operating system is not supported by this script.${nc}\n"
echo "Please ensure you are using one of the following supported operating systems:"
echo "- Ubuntu 20.04+"
echo "- Debian 10+"
echo "- CentOS 8+"
echo "- AlmaLinux 8.0+"
echo "- Rocky Linux 8+"
exit 1
fi
case "${release}" in
centos | almalinux | rocky)
curl -fsSl https://pkg.cloudflareclient.com/cloudflare-warp-ascii.repo | sudo tee /etc/yum.repos.d/cloudflare-warp.repo
sudo yum update -y && sudo yum install cloudflare-warp -y
;;
ubuntu )
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update -y && sudo apt-get install cloudflare-warp -y
;;
debian )
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update -y && sudo apt-get install cloudflare-warp -y
;;
*)
header
echo -e "${red}Your operating system is not supported by this script.${nc}\n"
echo "Please ensure you are using one of the following supported operating systems:"
echo "- Ubuntu 20.04+"
echo "- Debian 10+"
echo "- CentOS 8+"
echo "- AlmaLinux 8.0+"
echo "- Rocky Linux 8+"
exit 1
esac
echo "y" | warp-cli registration new
warp-cli mode proxy
warp-cli proxy port 10864
echo "y" | warp-cli connect
clear
header
echo -e "${green}Service Successfully Installed !${nc}"
echo ""
echo -e "${blue}Socks-Port :${White} 10864${nc}"
echo ""
warp-cli status
echo ""
echo -e "${red}==================================${nc}"