-
Notifications
You must be signed in to change notification settings - Fork 7
/
cndomain.sh
45 lines (40 loc) · 1.3 KB
/
cndomain.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
#!/bin/bash
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
sudoCmd="sudo"
else
sudoCmd=""
fi
#copied & modified from atrandys trojan scripts
#copy from 秋水逸冰 ss scripts
if [[ -f /etc/redhat-release ]]; then
release="centos"
systemPackage="yum"
elif cat /etc/issue | grep -Eqi "debian"; then
release="debian"
systemPackage="apt-get"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
release="ubuntu"
systemPackage="apt-get"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
release="centos"
systemPackage="yum"
elif cat /proc/version | grep -Eqi "debian"; then
release="debian"
systemPackage="apt-get"
elif cat /proc/version | grep -Eqi "ubuntu"; then
release="ubuntu"
systemPackage="apt-get"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
release="centos"
systemPackage="yum"
fi
if [ ${systemPackage} == "yum" ]; then
${sudoCmd} ${systemPackage} install wget -y -q
else
${sudoCmd} ${systemPackage} install wget -y -qq
fi
wget -N --no-check-certificate -O cndomain.txt https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Shadowrocket/ChinaMax/ChinaMax_Domain.list
cn_domain_filename="cndomain.txt"
#开始处理 cn_domain_filename 内容
sed -i '/^#/d' ${cn_domain_filename}
sed -i '/^\./ s/^.//; s/\(.*\)/domain:\1/g' ${cn_domain_filename}