forked from 07031218/normal-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netflix-verify.sh
60 lines (56 loc) · 1.6 KB
/
netflix-verify.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
checkos(){
ifTermux=$(echo $PWD | grep termux)
ifMacOS=$(uname -a | grep Darwin)
if [ -n "$ifTermux" ];then
os_version=Termux
elif [ -n "$ifMacOS" ];then
os_version=MacOS
else
os_version=$(grep 'VERSION_ID' /etc/os-release | cut -d '"' -f 2 | tr -d '.')
fi
if [[ "$os_version" == "2004" ]] || [[ "$os_version" == "10" ]] || [[ "$os_version" == "11" ]];then
ssll="-k --ciphers DEFAULT@SECLEVEL=1"
fi
}
checkos
checkCPU(){
CPUArch=$(uname -m)
if [[ "$CPUArch" == "aarch64" ]];then
arch=linux_arm64
elif [[ "$CPUArch" == "i686" ]];then
arch=linux_386
elif [[ "$CPUArch" == "arm" ]];then
arch=linux_arm
elif [[ "$CPUArch" == "x86_64" ]] && [ -n "$ifMacOS" ];then
arch=darwin_amd64
elif [[ "$CPUArch" == "x86_64" ]];then
arch=linux_amd64
fi
}
checkCPU
check_dependencies(){
os_detail=$(cat /etc/os-release 2> /dev/null)
if_debian=$(echo $os_detail | grep 'ebian')
if_redhat=$(echo $os_detail | grep 'rhel')
if [ -n "$if_debian" ];then
InstallMethod="apt"
elif [ -n "$if_redhat" ] && [[ "$os_version" -lt 8 ]];then
InstallMethod="yum"
elif [[ "$os_version" == "MacOS" ]];then
InstallMethod="brew"
fi
}
check_dependencies
if test -z "$(which wget)"; then
echo -e "检测到系统未安装wget,开始安装wget"
${InstallMethod} install wget -y > /dev/null 2>&1
fi
version=$(curl -s 'https://api.github.com/repos/sjlleo/netflix-verify/releases'|grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'|head -1)
#下载检测程序
wget -O nf https://github.com/sjlleo/netflix-verify/releases/download/${version}/nf_${arch}
chmod +x nf > /dev/null 2>&1
clear
./nf
rm nf
exit